Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JoinToTimeSpineNode.with_new_parents() #1672

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading