From a716bc720f4036f2d9f5f04567760ff664ae7a4d Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Thu, 30 Nov 2023 10:43:07 -0800 Subject: [PATCH] Add snapshots for filter spec resolution tests. --- ...tion_for_invalid_metric_filter__result.txt | 60 +++++++++++++++++ ...or_invalid_metric_input_filter__result.txt | 60 +++++++++++++++++ ...lution_for_valid_metric_filter__result.txt | 27 ++++++++ ..._for_valid_metric_input_filter__result.txt | 28 ++++++++ ...ccumulate_last_2_months_metric__result.txt | 24 +++++++ ...h_different_parent_time_grains__result.txt | 67 +++++++++++++++++++ ...c_with_same_parent_time_grains__result.txt | 24 +++++++ ...ics_with_different_time_grains__result.txt | 60 +++++++++++++++++ ..._metrics_with_same_time_grains__result.txt | 27 ++++++++ ...er_spec_resolution__no_metrics__result.txt | 1 + ...spec_resolution__simple_metric__result.txt | 24 +++++++ 11 files changed, 402 insertions(+) create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_invalid_metric_filter__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_invalid_metric_input_filter__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_valid_metric_filter__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_valid_metric_input_filter__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__accumulate_last_2_months_metric__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__derived_metric_with_different_parent_time_grains__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__derived_metric_with_same_parent_time_grains__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__metrics_with_different_time_grains__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__metrics_with_same_time_grains__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__no_metrics__result.txt create mode 100644 metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__simple_metric__result.txt diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_invalid_metric_filter__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_invalid_metric_filter__result.txt new file mode 100644 index 0000000000..b6ec19be12 --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_invalid_metric_filter__result.txt @@ -0,0 +1,60 @@ +FilterSpecResolutionLookUp( + issue_set=MetricFlowQueryResolutionIssueSet( + issues=( + NoCommonItemsInParents( + issue_type=ERROR, + query_resolution_path=MetricFlowQueryResolutionPath( + resolution_path_nodes=(MetricGroupByItemResolutionNode(node_id=mtr_2),), + ), + parent_candidate_sets=( + GroupByItemCandidateSet( + specs=( + TimeDimensionSpec( + element_name='metric_time', + time_granularity=MONTH, + ), + ), + measure_paths=( + MetricFlowQueryResolutionPath( + resolution_path_nodes=( + MetricGroupByItemResolutionNode(node_id=mtr_2), + MetricGroupByItemResolutionNode(node_id=mtr_0), + MeasureGroupByItemSourceNode(node_id=msr_0), + ), + ), + ), + path_from_leaf_node=MetricFlowQueryResolutionPath( + resolution_path_nodes=( + MetricGroupByItemResolutionNode(node_id=mtr_2), + MetricGroupByItemResolutionNode(node_id=mtr_0), + ), + ), + ), + GroupByItemCandidateSet( + specs=( + TimeDimensionSpec( + element_name='metric_time', + time_granularity=YEAR, + ), + ), + measure_paths=( + MetricFlowQueryResolutionPath( + resolution_path_nodes=( + MetricGroupByItemResolutionNode(node_id=mtr_2), + MetricGroupByItemResolutionNode(node_id=mtr_1), + MeasureGroupByItemSourceNode(node_id=msr_1), + ), + ), + ), + path_from_leaf_node=MetricFlowQueryResolutionPath( + resolution_path_nodes=( + MetricGroupByItemResolutionNode(node_id=mtr_2), + MetricGroupByItemResolutionNode(node_id=mtr_1), + ), + ), + ), + ), + ), + ), + ), +) diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_invalid_metric_input_filter__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_invalid_metric_input_filter__result.txt new file mode 100644 index 0000000000..b6ec19be12 --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_invalid_metric_input_filter__result.txt @@ -0,0 +1,60 @@ +FilterSpecResolutionLookUp( + issue_set=MetricFlowQueryResolutionIssueSet( + issues=( + NoCommonItemsInParents( + issue_type=ERROR, + query_resolution_path=MetricFlowQueryResolutionPath( + resolution_path_nodes=(MetricGroupByItemResolutionNode(node_id=mtr_2),), + ), + parent_candidate_sets=( + GroupByItemCandidateSet( + specs=( + TimeDimensionSpec( + element_name='metric_time', + time_granularity=MONTH, + ), + ), + measure_paths=( + MetricFlowQueryResolutionPath( + resolution_path_nodes=( + MetricGroupByItemResolutionNode(node_id=mtr_2), + MetricGroupByItemResolutionNode(node_id=mtr_0), + MeasureGroupByItemSourceNode(node_id=msr_0), + ), + ), + ), + path_from_leaf_node=MetricFlowQueryResolutionPath( + resolution_path_nodes=( + MetricGroupByItemResolutionNode(node_id=mtr_2), + MetricGroupByItemResolutionNode(node_id=mtr_0), + ), + ), + ), + GroupByItemCandidateSet( + specs=( + TimeDimensionSpec( + element_name='metric_time', + time_granularity=YEAR, + ), + ), + measure_paths=( + MetricFlowQueryResolutionPath( + resolution_path_nodes=( + MetricGroupByItemResolutionNode(node_id=mtr_2), + MetricGroupByItemResolutionNode(node_id=mtr_1), + MeasureGroupByItemSourceNode(node_id=msr_1), + ), + ), + ), + path_from_leaf_node=MetricFlowQueryResolutionPath( + resolution_path_nodes=( + MetricGroupByItemResolutionNode(node_id=mtr_2), + MetricGroupByItemResolutionNode(node_id=mtr_1), + ), + ), + ), + ), + ), + ), + ), +) diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_valid_metric_filter__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_valid_metric_filter__result.txt new file mode 100644 index 0000000000..0acc0fa8c2 --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_valid_metric_filter__result.txt @@ -0,0 +1,27 @@ +FilterSpecResolutionLookUp( + spec_resolutions=( + FilterSpecResolution( + lookup_key=ResolvedSpecLookUpKey( + filter_location=WhereFilterLocation( + metric_references=( + MetricReference( + element_name='derived_metric_with_same_parent_time_grains', + ), + ), + ), + call_parameter_set=TimeDimensionCallParameterSet( + time_dimension_reference=TimeDimensionReference( + element_name='metric_time', + ), + ), + ), + resolution_path=MetricFlowQueryResolutionPath( + resolution_path_nodes=( + QueryGroupByItemResolutionNode(node_id=qr_0), + MetricGroupByItemResolutionNode(node_id=mtr_2), + ), + ), + resolved_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH), + ), + ), +) diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_valid_metric_input_filter__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_valid_metric_input_filter__result.txt new file mode 100644 index 0000000000..3b5912009b --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_resolution_for_valid_metric_input_filter__result.txt @@ -0,0 +1,28 @@ +FilterSpecResolutionLookUp( + spec_resolutions=( + FilterSpecResolution( + lookup_key=ResolvedSpecLookUpKey( + filter_location=WhereFilterLocation( + metric_references=( + MetricReference( + element_name='derived_metric_with_same_parent_time_grains', + ), + ), + ), + call_parameter_set=TimeDimensionCallParameterSet( + time_dimension_reference=TimeDimensionReference( + element_name='metric_time', + ), + ), + ), + resolution_path=MetricFlowQueryResolutionPath( + resolution_path_nodes=( + QueryGroupByItemResolutionNode(node_id=qr_0), + MetricGroupByItemResolutionNode(node_id=mtr_3), + MetricGroupByItemResolutionNode(node_id=mtr_2), + ), + ), + resolved_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH), + ), + ), +) diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__accumulate_last_2_months_metric__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__accumulate_last_2_months_metric__result.txt new file mode 100644 index 0000000000..4b26839e47 --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__accumulate_last_2_months_metric__result.txt @@ -0,0 +1,24 @@ +FilterSpecResolutionLookUp( + spec_resolutions=( + FilterSpecResolution( + lookup_key=ResolvedSpecLookUpKey( + filter_location=WhereFilterLocation( + metric_references=( + MetricReference( + element_name='accumulate_last_2_months_metric', + ), + ), + ), + call_parameter_set=TimeDimensionCallParameterSet( + time_dimension_reference=TimeDimensionReference( + element_name='metric_time', + ), + ), + ), + resolution_path=MetricFlowQueryResolutionPath( + resolution_path_nodes=(QueryGroupByItemResolutionNode(node_id=qr_6),), + ), + resolved_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH), + ), + ), +) diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__derived_metric_with_different_parent_time_grains__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__derived_metric_with_different_parent_time_grains__result.txt new file mode 100644 index 0000000000..1bd07a1366 --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__derived_metric_with_different_parent_time_grains__result.txt @@ -0,0 +1,67 @@ +FilterSpecResolutionLookUp( + 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), + ), + ), + parent_candidate_sets=( + GroupByItemCandidateSet( + specs=( + TimeDimensionSpec( + element_name='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), + ), + ), + ), + GroupByItemCandidateSet( + specs=( + TimeDimensionSpec( + element_name='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), + ), + ), + ), + ), + ), + ), + ), +) diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__derived_metric_with_same_parent_time_grains__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__derived_metric_with_same_parent_time_grains__result.txt new file mode 100644 index 0000000000..4fa76f6f95 --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__derived_metric_with_same_parent_time_grains__result.txt @@ -0,0 +1,24 @@ +FilterSpecResolutionLookUp( + spec_resolutions=( + FilterSpecResolution( + lookup_key=ResolvedSpecLookUpKey( + filter_location=WhereFilterLocation( + metric_references=( + MetricReference( + element_name='derived_metric_with_same_parent_time_grains', + ), + ), + ), + call_parameter_set=TimeDimensionCallParameterSet( + time_dimension_reference=TimeDimensionReference( + element_name='metric_time', + ), + ), + ), + resolution_path=MetricFlowQueryResolutionPath( + resolution_path_nodes=(QueryGroupByItemResolutionNode(node_id=qr_4),), + ), + resolved_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH), + ), + ), +) diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__metrics_with_different_time_grains__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__metrics_with_different_time_grains__result.txt new file mode 100644 index 0000000000..d6a08ccf23 --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__metrics_with_different_time_grains__result.txt @@ -0,0 +1,60 @@ +FilterSpecResolutionLookUp( + issue_set=MetricFlowQueryResolutionIssueSet( + issues=( + NoCommonItemsInParents( + issue_type=ERROR, + query_resolution_path=MetricFlowQueryResolutionPath( + resolution_path_nodes=(QueryGroupByItemResolutionNode(node_id=qr_3),), + ), + parent_candidate_sets=( + GroupByItemCandidateSet( + specs=( + TimeDimensionSpec( + element_name='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), + ), + ), + ), + GroupByItemCandidateSet( + specs=( + TimeDimensionSpec( + element_name='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), + ), + ), + ), + path_from_leaf_node=MetricFlowQueryResolutionPath( + resolution_path_nodes=( + QueryGroupByItemResolutionNode(node_id=qr_3), + MetricGroupByItemResolutionNode(node_id=mtr_4), + ), + ), + ), + ), + ), + ), + ), +) diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__metrics_with_same_time_grains__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__metrics_with_same_time_grains__result.txt new file mode 100644 index 0000000000..53bfccffec --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__metrics_with_same_time_grains__result.txt @@ -0,0 +1,27 @@ +FilterSpecResolutionLookUp( + spec_resolutions=( + FilterSpecResolution( + lookup_key=ResolvedSpecLookUpKey( + filter_location=WhereFilterLocation( + metric_references=( + MetricReference( + element_name='monthly_metric_0', + ), + MetricReference( + element_name='monthly_metric_1', + ), + ), + ), + call_parameter_set=TimeDimensionCallParameterSet( + time_dimension_reference=TimeDimensionReference( + element_name='metric_time', + ), + ), + ), + resolution_path=MetricFlowQueryResolutionPath( + resolution_path_nodes=(QueryGroupByItemResolutionNode(node_id=qr_2),), + ), + resolved_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH), + ), + ), +) diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__no_metrics__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__no_metrics__result.txt new file mode 100644 index 0000000000..94bf6e8bb4 --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__no_metrics__result.txt @@ -0,0 +1 @@ +FilterSpecResolutionLookUp() diff --git a/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__simple_metric__result.txt b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__simple_metric__result.txt new file mode 100644 index 0000000000..70a636e325 --- /dev/null +++ b/metricflow/test/snapshots/test_spec_lookup.py/str/test_filter_spec_resolution__simple_metric__result.txt @@ -0,0 +1,24 @@ +FilterSpecResolutionLookUp( + spec_resolutions=( + FilterSpecResolution( + lookup_key=ResolvedSpecLookUpKey( + filter_location=WhereFilterLocation( + metric_references=( + MetricReference( + element_name='monthly_metric_0', + ), + ), + ), + call_parameter_set=TimeDimensionCallParameterSet( + time_dimension_reference=TimeDimensionReference( + element_name='metric_time', + ), + ), + ), + resolution_path=MetricFlowQueryResolutionPath( + resolution_path_nodes=(QueryGroupByItemResolutionNode(node_id=qr_1),), + ), + resolved_spec=TimeDimensionSpec(element_name='metric_time', time_granularity=MONTH), + ), + ), +)