Skip to content

Commit

Permalink
Update multi_hop_join_manifest fixture names.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed Feb 5, 2024
1 parent e07543f commit 0ec9b86
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 27 deletions.
4 changes: 2 additions & 2 deletions metricflow/test/dataflow/builder/test_node_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ 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,
multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
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"]
Expand All @@ -364,7 +364,7 @@ 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,
semantic_manifest_lookup_with_multihop_links=multi_hop_join_semantic_manifest_lookup,
semantic_manifest_lookup_with_multihop_links=partitioned_multi_hop_join_semantic_manifest_lookup,
desired_linkable_specs=linkable_specs,
)

Expand Down
4 changes: 2 additions & 2 deletions metricflow/test/fixtures/dataflow_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def extended_date_dataflow_plan_builder( # noqa: D

@pytest.fixture
def multihop_dataflow_plan_builder( # noqa: D
multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
consistent_id_object_repository: ConsistentIdObjectRepository,
time_spine_source: TimeSpineSource,
) -> 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=multi_hop_join_semantic_manifest_lookup,
semantic_manifest_lookup=partitioned_multi_hop_join_semantic_manifest_lookup,
time_spine_source_node=consistent_id_object_repository.multihop_model_time_spine_source_node,
)

Expand Down
20 changes: 10 additions & 10 deletions metricflow/test/fixtures/model_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class ConsistentIdObjectRepository:
@pytest.fixture(scope="session")
def consistent_id_object_repository(
simple_semantic_manifest_lookup: SemanticManifestLookup,
multi_hop_join_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,
Expand All @@ -122,7 +122,7 @@ def consistent_id_object_repository(
"""
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(multi_hop_join_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)
Expand All @@ -135,10 +135,10 @@ def consistent_id_object_repository(
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(
multi_hop_join_semantic_manifest_lookup, multihop_data_sets
partitioned_multi_hop_join_semantic_manifest_lookup, multihop_data_sets
),
multihop_model_time_spine_source_node=_build_time_spine_source_node(
multi_hop_join_semantic_manifest_lookup
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),
Expand Down Expand Up @@ -223,16 +223,16 @@ def simple_semantic_manifest_lookup(template_mapping: Dict[str, str]) -> Semanti


@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/partitioned_semantic_models", template_mapping)
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 unpartitioned_multi_hop_join_semantic_manifest_lookup( # noqa: D
template_mapping: Dict[str, str]
) -> SemanticManifestLookup:
build_result = load_semantic_manifest("multi_hop_join_manifest/unpartitioned_semantic_models", template_mapping)
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)


Expand Down
6 changes: 3 additions & 3 deletions metricflow/test/integration/test_configured_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ def test_case(
mf_test_session_state: MetricFlowTestSessionState,
simple_semantic_manifest_lookup: SemanticManifestLookup,
simple_semantic_manifest_lookup_non_ds: SemanticManifestLookup,
unpartitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
extended_date_semantic_manifest_lookup: SemanticManifestLookup,
scd_semantic_manifest_lookup: SemanticManifestLookup,
sql_client: SqlClient,
Expand All @@ -259,9 +259,9 @@ def test_case(
elif case.model is IntegrationTestModel.SIMPLE_MODEL_NON_DS:
semantic_manifest_lookup = simple_semantic_manifest_lookup_non_ds
elif case.model is IntegrationTestModel.UNPARTITIONED_MULTI_HOP_JOIN_MODEL:
semantic_manifest_lookup = unpartitioned_multi_hop_join_semantic_manifest_lookup
elif case.model is IntegrationTestModel.PARTITIONED_MULTI_HOP_JOIN_MODEL:
semantic_manifest_lookup = multi_hop_join_semantic_manifest_lookup
elif case.model is IntegrationTestModel.PARTITIONED_MULTI_HOP_JOIN_MODEL:
semantic_manifest_lookup = partitioned_multi_hop_join_semantic_manifest_lookup
elif case.model is IntegrationTestModel.EXTENDED_DATE_MODEL:
semantic_manifest_lookup = extended_date_semantic_manifest_lookup
elif case.model is IntegrationTestModel.SCD_MODEL:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,11 @@ def test_foreign_target_instance_set_join_validation(


def test_get_joinable_semantic_models_single_hop( # noqa: D
multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
) -> None:
semantic_model_reference = SemanticModelReference(semantic_model_name="account_month_txns")
join_evaluator = SemanticModelJoinEvaluator(
semantic_model_lookup=multi_hop_join_semantic_manifest_lookup.semantic_model_lookup
semantic_model_lookup=partitioned_multi_hop_join_semantic_manifest_lookup.semantic_model_lookup
)

# Single-hop
Expand All @@ -333,11 +333,11 @@ def test_get_joinable_semantic_models_single_hop( # noqa: D


def test_get_joinable_semantic_models_multi_hop( # noqa: D
multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
) -> None:
semantic_model_reference = SemanticModelReference(semantic_model_name="account_month_txns")
join_evaluator = SemanticModelJoinEvaluator(
semantic_model_lookup=multi_hop_join_semantic_manifest_lookup.semantic_model_lookup
semantic_model_lookup=partitioned_multi_hop_join_semantic_manifest_lookup.semantic_model_lookup
)

# 2-hop
Expand Down
8 changes: 5 additions & 3 deletions metricflow/test/plan_conversion/test_dataflow_to_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_multihop_joined_plan( # noqa: D
request: FixtureRequest,
mf_test_session_state: MetricFlowTestSessionState,
multihop_dataflow_plan_builder: DataflowPlanBuilder,
multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
sql_client: SqlClient,
) -> None:
"""Tests a plan getting a measure and a joined dimension."""
Expand All @@ -176,8 +176,10 @@ def test_multihop_joined_plan( # noqa: D

to_execution_plan_converter = DataflowToExecutionPlanConverter(
sql_plan_converter=DataflowToSqlQueryPlanConverter(
column_association_resolver=DunderColumnAssociationResolver(multi_hop_join_semantic_manifest_lookup),
semantic_manifest_lookup=multi_hop_join_semantic_manifest_lookup,
column_association_resolver=DunderColumnAssociationResolver(
partitioned_multi_hop_join_semantic_manifest_lookup
),
semantic_manifest_lookup=partitioned_multi_hop_join_semantic_manifest_lookup,
),
sql_plan_renderer=DefaultSqlQueryPlanRenderer(),
sql_client=sql_client,
Expand Down
8 changes: 5 additions & 3 deletions metricflow/test/query_rendering/test_query_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@

@pytest.fixture(scope="session")
def multihop_dataflow_to_sql_converter( # noqa: D
multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
partitioned_multi_hop_join_semantic_manifest_lookup: SemanticManifestLookup,
) -> DataflowToSqlQueryPlanConverter:
return DataflowToSqlQueryPlanConverter(
column_association_resolver=DunderColumnAssociationResolver(multi_hop_join_semantic_manifest_lookup),
semantic_manifest_lookup=multi_hop_join_semantic_manifest_lookup,
column_association_resolver=DunderColumnAssociationResolver(
partitioned_multi_hop_join_semantic_manifest_lookup
),
semantic_manifest_lookup=partitioned_multi_hop_join_semantic_manifest_lookup,
)


Expand Down

0 comments on commit 0ec9b86

Please sign in to comment.