Skip to content

Commit

Permalink
Rename subgraph helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
tlento committed May 16, 2024
1 parent d9a68cb commit c1faf9a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions metricflow/dataflow/dataflow_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ def __init__(self, sink_nodes: Sequence[DataflowPlanNode], plan_id: Optional[Dag
def sink_node(self) -> DataflowPlanNode: # noqa: D102
return self._sink_nodes[0]

def __complete_subgraph(self, node: DataflowPlanNode) -> Sequence[DataflowPlanNode]:
def __all_nodes_in_subgraph(self, node: DataflowPlanNode) -> Sequence[DataflowPlanNode]:
"""Node accessor for retrieving a flattened sequence of all nodes in the subgraph upstream of the input node.
Useful for gathering nodes for subtype-agnostic operations, such as common property access or simple counts.
"""
flattened_parent_subgraphs = tuple(
more_itertools.collapse(self.__complete_subgraph(parent_node) for parent_node in node.parent_nodes)
more_itertools.collapse(self.__all_nodes_in_subgraph(parent_node) for parent_node in node.parent_nodes)
)
return (node,) + flattened_parent_subgraphs

Expand All @@ -225,7 +225,7 @@ def source_semantic_models(self) -> FrozenSet[SemanticModelReference]:
return frozenset(
[
node._input_semantic_model
for node in self.__complete_subgraph(self.sink_node)
for node in self.__all_nodes_in_subgraph(self.sink_node)
if node._input_semantic_model is not None
]
)

0 comments on commit c1faf9a

Please sign in to comment.