-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add metric alias step in dataflow plan builder
This commit makes the `DataflowPlanBuilder` add an extra `AliasSpecsNode` at the end of the plan in case any of the input metric specs has an alias.
- Loading branch information
1 parent
2b819ee
commit cb8a4cc
Showing
3 changed files
with
100 additions
and
2 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
52 changes: 52 additions & 0 deletions
52
...apshots/test_dataflow_plan_builder.py/DataflowPlan/test_metric_with_alias_plan__dfp_0.xml
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,52 @@ | ||
test_name: test_metric_with_alias_plan | ||
test_filename: test_dataflow_plan_builder.py | ||
docstring: | ||
Tests a simple plan getting a metric and a local dimension. | ||
--- | ||
<DataflowPlan> | ||
<WriteToResultDataTableNode> | ||
<!-- description = 'Write to DataTable' --> | ||
<!-- node_id = NodeId(id_str='wrd_0') --> | ||
<AliasSpecsNode> | ||
<!-- description = 'Change Column Aliases' --> | ||
<!-- node_id = NodeId(id_str='as_0') --> | ||
<!-- change_specs = --> | ||
<!-- ( --> | ||
<!-- SpecToAlias( --> | ||
<!-- input_spec=MetricSpec(element_name='bookings', filter_spec_set=WhereFilterSpecSet()), --> | ||
<!-- output_spec=MetricSpec(element_name='bookings_alias', filter_spec_set=WhereFilterSpecSet()), --> | ||
<!-- ), --> | ||
<!-- ) --> | ||
<ComputeMetricsNode> | ||
<!-- description = 'Compute Metrics via Expressions' --> | ||
<!-- node_id = NodeId(id_str='cm_0') --> | ||
<!-- metric_spec = MetricSpec(element_name='bookings', filter_spec_set=WhereFilterSpecSet()) --> | ||
<AggregateMeasuresNode> | ||
<!-- description = 'Aggregate Measures' --> | ||
<!-- node_id = NodeId(id_str='am_0') --> | ||
<FilterElementsNode> | ||
<!-- description = "Pass Only Elements: ['bookings', 'booking__is_instant']" --> | ||
<!-- node_id = NodeId(id_str='pfe_0') --> | ||
<!-- include_spec = MeasureSpec(element_name='bookings') --> | ||
<!-- include_spec = --> | ||
<!-- DimensionSpec( --> | ||
<!-- element_name='is_instant', --> | ||
<!-- entity_links=(EntityReference(element_name='booking'),), --> | ||
<!-- ) --> | ||
<!-- distinct = False --> | ||
<MetricTimeDimensionTransformNode> | ||
<!-- description = "Metric Time Dimension 'ds'" --> | ||
<!-- node_id = NodeId(id_str='sma_28009') --> | ||
<!-- aggregation_time_dimension = 'ds' --> | ||
<ReadSqlSourceNode> | ||
<!-- description = "Read From SemanticModelDataSet('bookings_source')" --> | ||
<!-- node_id = NodeId(id_str='rss_28020') --> | ||
<!-- data_set = SemanticModelDataSet('bookings_source') --> | ||
</ReadSqlSourceNode> | ||
</MetricTimeDimensionTransformNode> | ||
</FilterElementsNode> | ||
</AggregateMeasuresNode> | ||
</ComputeMetricsNode> | ||
</AliasSpecsNode> | ||
</WriteToResultDataTableNode> | ||
</DataflowPlan> |