-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
/* PR_START p--cte 14 */ Move
DataflowPlanNodeVisitor
to a separate…
… file.
- Loading branch information
Showing
28 changed files
with
162 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
from __future__ import annotations | ||
|
||
import typing | ||
from abc import ABC, abstractmethod | ||
from typing import Generic | ||
|
||
from metricflow_semantics.visitor import VisitorOutputT | ||
|
||
if typing.TYPE_CHECKING: | ||
from metricflow.dataflow.nodes.add_generated_uuid import AddGeneratedUuidColumnNode | ||
from metricflow.dataflow.nodes.aggregate_measures import AggregateMeasuresNode | ||
from metricflow.dataflow.nodes.combine_aggregated_outputs import CombineAggregatedOutputsNode | ||
from metricflow.dataflow.nodes.compute_metrics import ComputeMetricsNode | ||
from metricflow.dataflow.nodes.constrain_time import ConstrainTimeRangeNode | ||
from metricflow.dataflow.nodes.filter_elements import FilterElementsNode | ||
from metricflow.dataflow.nodes.join_conversion_events import JoinConversionEventsNode | ||
from metricflow.dataflow.nodes.join_over_time import JoinOverTimeRangeNode | ||
from metricflow.dataflow.nodes.join_to_base import JoinOnEntitiesNode | ||
from metricflow.dataflow.nodes.join_to_custom_granularity import JoinToCustomGranularityNode | ||
from metricflow.dataflow.nodes.join_to_time_spine import JoinToTimeSpineNode | ||
from metricflow.dataflow.nodes.metric_time_transform import MetricTimeDimensionTransformNode | ||
from metricflow.dataflow.nodes.min_max import MinMaxNode | ||
from metricflow.dataflow.nodes.order_by_limit import OrderByLimitNode | ||
from metricflow.dataflow.nodes.read_sql_source import ReadSqlSourceNode | ||
from metricflow.dataflow.nodes.semi_additive_join import SemiAdditiveJoinNode | ||
from metricflow.dataflow.nodes.where_filter import WhereConstraintNode | ||
from metricflow.dataflow.nodes.window_reaggregation_node import WindowReaggregationNode | ||
from metricflow.dataflow.nodes.write_to_data_table import WriteToResultDataTableNode | ||
from metricflow.dataflow.nodes.write_to_table import WriteToResultTableNode | ||
|
||
|
||
class DataflowPlanNodeVisitor(Generic[VisitorOutputT], ABC): | ||
"""An object that can be used to visit the nodes of a dataflow plan. | ||
Follows the visitor pattern: https://en.wikipedia.org/wiki/Visitor_pattern | ||
All visit* methods are similar and one exists for every type of node in the dataflow plan. The appropriate method | ||
will be called with DataflowPlanNode.accept(). | ||
""" | ||
|
||
@abstractmethod | ||
def visit_source_node(self, node: ReadSqlSourceNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_join_on_entities_node(self, node: JoinOnEntitiesNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_aggregate_measures_node(self, node: AggregateMeasuresNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_compute_metrics_node(self, node: ComputeMetricsNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_window_reaggregation_node(self, node: WindowReaggregationNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_order_by_limit_node(self, node: OrderByLimitNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_where_constraint_node(self, node: WhereConstraintNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_write_to_result_data_table_node(self, node: WriteToResultDataTableNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_write_to_result_table_node(self, node: WriteToResultTableNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_filter_elements_node(self, node: FilterElementsNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_combine_aggregated_outputs_node(self, node: CombineAggregatedOutputsNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_constrain_time_range_node(self, node: ConstrainTimeRangeNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_join_over_time_range_node(self, node: JoinOverTimeRangeNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_semi_additive_join_node(self, node: SemiAdditiveJoinNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_metric_time_dimension_transform_node( # noqa: D102 | ||
self, node: MetricTimeDimensionTransformNode | ||
) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_join_to_time_spine_node(self, node: JoinToTimeSpineNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_min_max_node(self, node: MinMaxNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_add_generated_uuid_column_node(self, node: AddGeneratedUuidColumnNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_join_conversion_events_node(self, node: JoinConversionEventsNode) -> VisitorOutputT: # noqa: D102 | ||
pass | ||
|
||
@abstractmethod | ||
def visit_join_to_custom_granularity_node(self, node: JoinToCustomGranularityNode) -> VisitorOutputT: # noqa: D102 | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.