Skip to content

Commit

Permalink
Fix JoinToTimeSpineNode.with_new_parents() (#1672)
Browse files Browse the repository at this point in the history
This PR fixes an issue with `JoinToTimeSpineNode.with_new_parents()`
where it was not using the new parents.
  • Loading branch information
plypaul authored Feb 18, 2025
1 parent ee06a99 commit b63a8a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions metricflow/dataflow/dataflow_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def functionally_identical(self, other_node: DataflowPlanNode) -> bool:
def with_new_parents(self: NodeSelfT, new_parent_nodes: Sequence[DataflowPlanNode]) -> NodeSelfT:
"""Creates a node with the same behavior as this node, but with a different set of parents.
Callers are required to call this method with new parent nodes that are of the appropriate type and order as
required by the subclass.
typing.Self would be useful here, but not available in Python 3.8.
"""
raise NotImplementedError
Expand Down
8 changes: 5 additions & 3 deletions metricflow/dataflow/nodes/join_to_time_spine.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@ def functionally_identical(self, other_node: DataflowPlanNode) -> bool: # noqa:
)

def with_new_parents(self, new_parent_nodes: Sequence[DataflowPlanNode]) -> JoinToTimeSpineNode: # noqa: D102
assert len(new_parent_nodes) == 1
assert len(new_parent_nodes) == 2
metric_source_node = new_parent_nodes[0]
time_spine_node = new_parent_nodes[1]
return JoinToTimeSpineNode.create(
metric_source_node=self.metric_source_node,
time_spine_node=self.time_spine_node,
metric_source_node=metric_source_node,
time_spine_node=time_spine_node,
requested_agg_time_dimension_specs=self.requested_agg_time_dimension_specs,
standard_offset_window=self.standard_offset_window,
offset_to_grain=self.offset_to_grain,
Expand Down

0 comments on commit b63a8a7

Please sign in to comment.