-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use
MetricTimeDefaultGranularityPattern
to resolve metric_time
gr…
…anularity (#1332) Resolve metric time using new spec pattern in group by and filter nodes. This is a change from defaulting to the minimum time granularity for `metric_time`. Now we will use the max default granularity for the requested metrics. Note the snapshot updates. These reflect another behavior change in which we don't error if `metric_time` is queried for metrics with two different default granularities. Instead, we choose the larger of the two, which is guaranteed to work for both metrics.
- Loading branch information
1 parent
2296688
commit e46af9a
Showing
9 changed files
with
263 additions
and
613 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Features | ||
body: Use Metric.time_granularity to resolve metric_time. | ||
time: 2024-06-28T07:46:17.768805-07:00 | ||
custom: | ||
Author: courtneyholcomb | ||
Issue: "1310" |
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
132 changes: 34 additions & 98 deletions
132
...metric_time_in_query_filter__derived_metric_with_different_parent_time_grains__result.txt
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 |
---|---|---|
@@ -1,108 +1,44 @@ | ||
GroupByItemResolution( | ||
linkable_element_set=LinkableElementSet(), | ||
issue_set=MetricFlowQueryResolutionIssueSet( | ||
issues=( | ||
NoCommonItemsInParents( | ||
issue_type=ERROR, | ||
query_resolution_path=MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=( | ||
QueryGroupByItemResolutionNode(node_id=qr_5), | ||
MetricGroupByItemResolutionNode(node_id=mtr_10), | ||
spec=TimeDimensionSpec(element_name='metric_time', time_granularity=YEAR), | ||
linkable_element_set=LinkableElementSet( | ||
path_key_to_linkable_dimensions={ | ||
ElementPathKey( | ||
element_name='metric_time', | ||
element_type=TIME_DIMENSION, | ||
time_granularity=YEAR, | ||
): ( | ||
LinkableDimension( | ||
defined_in_semantic_model=SemanticModelReference( | ||
semantic_model_name='monthly_measures_source', | ||
), | ||
), | ||
parent_candidate_sets=( | ||
GroupByItemCandidateSet( | ||
linkable_element_set=LinkableElementSet( | ||
path_key_to_linkable_dimensions={ | ||
ElementPathKey( | ||
element_name='metric_time', | ||
element_type=TIME_DIMENSION, | ||
time_granularity=MONTH, | ||
): ( | ||
LinkableDimension( | ||
defined_in_semantic_model=SemanticModelReference( | ||
semantic_model_name='monthly_measures_source', | ||
), | ||
element_name='metric_time', | ||
dimension_type=TIME, | ||
join_path=SemanticModelJoinPath( | ||
left_semantic_model_reference=SemanticModelReference( | ||
semantic_model_name='monthly_measures_source', | ||
), | ||
), | ||
properties=frozenset( | ||
'METRIC_TIME', | ||
), | ||
time_granularity=MONTH, | ||
), | ||
), | ||
}, | ||
), | ||
measure_paths=( | ||
MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=( | ||
QueryGroupByItemResolutionNode(node_id=qr_5), | ||
MetricGroupByItemResolutionNode(node_id=mtr_10), | ||
MetricGroupByItemResolutionNode(node_id=mtr_8), | ||
MeasureGroupByItemSourceNode(node_id=msr_7), | ||
), | ||
), | ||
), | ||
path_from_leaf_node=MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=( | ||
QueryGroupByItemResolutionNode(node_id=qr_5), | ||
MetricGroupByItemResolutionNode(node_id=mtr_10), | ||
MetricGroupByItemResolutionNode(node_id=mtr_8), | ||
), | ||
element_name='metric_time', | ||
dimension_type=TIME, | ||
join_path=SemanticModelJoinPath( | ||
left_semantic_model_reference=SemanticModelReference( | ||
semantic_model_name='monthly_measures_source', | ||
), | ||
), | ||
GroupByItemCandidateSet( | ||
linkable_element_set=LinkableElementSet( | ||
path_key_to_linkable_dimensions={ | ||
ElementPathKey( | ||
element_name='metric_time', | ||
element_type=TIME_DIMENSION, | ||
time_granularity=YEAR, | ||
): ( | ||
LinkableDimension( | ||
defined_in_semantic_model=SemanticModelReference( | ||
semantic_model_name='yearly_measure_source', | ||
), | ||
element_name='metric_time', | ||
dimension_type=TIME, | ||
join_path=SemanticModelJoinPath( | ||
left_semantic_model_reference=SemanticModelReference( | ||
semantic_model_name='yearly_measure_source', | ||
), | ||
), | ||
properties=frozenset( | ||
'METRIC_TIME', | ||
), | ||
time_granularity=YEAR, | ||
), | ||
), | ||
}, | ||
), | ||
measure_paths=( | ||
MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=( | ||
QueryGroupByItemResolutionNode(node_id=qr_5), | ||
MetricGroupByItemResolutionNode(node_id=mtr_10), | ||
MetricGroupByItemResolutionNode(node_id=mtr_9), | ||
MeasureGroupByItemSourceNode(node_id=msr_8), | ||
), | ||
), | ||
), | ||
path_from_leaf_node=MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=( | ||
QueryGroupByItemResolutionNode(node_id=qr_5), | ||
MetricGroupByItemResolutionNode(node_id=mtr_10), | ||
MetricGroupByItemResolutionNode(node_id=mtr_9), | ||
), | ||
properties=frozenset( | ||
'DERIVED_TIME_GRANULARITY', | ||
'METRIC_TIME', | ||
), | ||
time_granularity=YEAR, | ||
), | ||
LinkableDimension( | ||
defined_in_semantic_model=SemanticModelReference( | ||
semantic_model_name='yearly_measure_source', | ||
), | ||
element_name='metric_time', | ||
dimension_type=TIME, | ||
join_path=SemanticModelJoinPath( | ||
left_semantic_model_reference=SemanticModelReference( | ||
semantic_model_name='yearly_measure_source', | ||
), | ||
), | ||
properties=frozenset('METRIC_TIME',), | ||
time_granularity=YEAR, | ||
), | ||
), | ||
), | ||
}, | ||
), | ||
) |
127 changes: 35 additions & 92 deletions
127
...est_ambiguous_metric_time_in_query_filter__metrics_with_different_time_grains__result.txt
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 |
---|---|---|
@@ -1,101 +1,44 @@ | ||
GroupByItemResolution( | ||
linkable_element_set=LinkableElementSet(), | ||
issue_set=MetricFlowQueryResolutionIssueSet( | ||
issues=( | ||
NoCommonItemsInParents( | ||
issue_type=ERROR, | ||
query_resolution_path=MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=(QueryGroupByItemResolutionNode(node_id=qr_3),), | ||
), | ||
parent_candidate_sets=( | ||
GroupByItemCandidateSet( | ||
linkable_element_set=LinkableElementSet( | ||
path_key_to_linkable_dimensions={ | ||
ElementPathKey( | ||
element_name='metric_time', | ||
element_type=TIME_DIMENSION, | ||
time_granularity=MONTH, | ||
): ( | ||
LinkableDimension( | ||
defined_in_semantic_model=SemanticModelReference( | ||
semantic_model_name='monthly_measures_source', | ||
), | ||
element_name='metric_time', | ||
dimension_type=TIME, | ||
join_path=SemanticModelJoinPath( | ||
left_semantic_model_reference=SemanticModelReference( | ||
semantic_model_name='monthly_measures_source', | ||
), | ||
), | ||
properties=frozenset( | ||
'METRIC_TIME', | ||
), | ||
time_granularity=MONTH, | ||
), | ||
), | ||
}, | ||
), | ||
measure_paths=( | ||
MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=( | ||
QueryGroupByItemResolutionNode(node_id=qr_3), | ||
MetricGroupByItemResolutionNode(node_id=mtr_3), | ||
MeasureGroupByItemSourceNode(node_id=msr_3), | ||
), | ||
), | ||
), | ||
path_from_leaf_node=MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=( | ||
QueryGroupByItemResolutionNode(node_id=qr_3), | ||
MetricGroupByItemResolutionNode(node_id=mtr_3), | ||
), | ||
), | ||
spec=TimeDimensionSpec(element_name='metric_time', time_granularity=YEAR), | ||
linkable_element_set=LinkableElementSet( | ||
path_key_to_linkable_dimensions={ | ||
ElementPathKey( | ||
element_name='metric_time', | ||
element_type=TIME_DIMENSION, | ||
time_granularity=YEAR, | ||
): ( | ||
LinkableDimension( | ||
defined_in_semantic_model=SemanticModelReference( | ||
semantic_model_name='monthly_measures_source', | ||
), | ||
GroupByItemCandidateSet( | ||
linkable_element_set=LinkableElementSet( | ||
path_key_to_linkable_dimensions={ | ||
ElementPathKey( | ||
element_name='metric_time', | ||
element_type=TIME_DIMENSION, | ||
time_granularity=YEAR, | ||
): ( | ||
LinkableDimension( | ||
defined_in_semantic_model=SemanticModelReference( | ||
semantic_model_name='yearly_measure_source', | ||
), | ||
element_name='metric_time', | ||
dimension_type=TIME, | ||
join_path=SemanticModelJoinPath( | ||
left_semantic_model_reference=SemanticModelReference( | ||
semantic_model_name='yearly_measure_source', | ||
), | ||
), | ||
properties=frozenset( | ||
'METRIC_TIME', | ||
), | ||
time_granularity=YEAR, | ||
), | ||
), | ||
}, | ||
), | ||
measure_paths=( | ||
MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=( | ||
QueryGroupByItemResolutionNode(node_id=qr_3), | ||
MetricGroupByItemResolutionNode(node_id=mtr_4), | ||
MeasureGroupByItemSourceNode(node_id=msr_4), | ||
), | ||
), | ||
element_name='metric_time', | ||
dimension_type=TIME, | ||
join_path=SemanticModelJoinPath( | ||
left_semantic_model_reference=SemanticModelReference( | ||
semantic_model_name='monthly_measures_source', | ||
), | ||
path_from_leaf_node=MetricFlowQueryResolutionPath( | ||
resolution_path_nodes=( | ||
QueryGroupByItemResolutionNode(node_id=qr_3), | ||
MetricGroupByItemResolutionNode(node_id=mtr_4), | ||
), | ||
), | ||
properties=frozenset( | ||
'DERIVED_TIME_GRANULARITY', | ||
'METRIC_TIME', | ||
), | ||
time_granularity=YEAR, | ||
), | ||
LinkableDimension( | ||
defined_in_semantic_model=SemanticModelReference( | ||
semantic_model_name='yearly_measure_source', | ||
), | ||
element_name='metric_time', | ||
dimension_type=TIME, | ||
join_path=SemanticModelJoinPath( | ||
left_semantic_model_reference=SemanticModelReference( | ||
semantic_model_name='yearly_measure_source', | ||
), | ||
), | ||
properties=frozenset('METRIC_TIME',), | ||
time_granularity=YEAR, | ||
), | ||
), | ||
), | ||
}, | ||
), | ||
) |
Oops, something went wrong.