Skip to content

Commit 5e5e7a3

Browse files
authored
Renames for the measures -> simple metrics migration - Part 3 (#1903)
This PR renames more references to `measures`.
1 parent a0fcf05 commit 5e5e7a3

File tree

162 files changed

+335
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+335
-348
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Under the Hood
2+
body: Renames for the `measures -> simple metrics` migration - Part 3
3+
time: 2025-10-13T14:08:59.631665-07:00
4+
custom:
5+
Author: plypaul
6+
Issue: "1903"

metricflow-semantics/metricflow_semantics/experimental/dsi/join_lookup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ def get_join_model_on_right_descriptors(
133133
# We cannot join two semantic models with validity dimensions due to concerns with unexpected fanout
134134
# due to the key structure of these semantic models. Applying multi-stage validity window filters can
135135
# also lead to unexpected removal of interim join keys. Note this will need to be updated if we enable
136-
# measures in such semantic models, since those will need to be converted to a different type of semantic model
137-
# to support measure computation.
136+
# simple-metric inputs in such semantic models, since those will need to be converted to a different type of semantic model
137+
# to support such computation.
138138
continue
139139

140140
if right_entity_type is EntityType.NATURAL and not right_model_has_validity_dimension:

metricflow-semantics/metricflow_semantics/experimental/semantic_graph/builder/simple_metric_subgraph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _add_edges_for_simple_metric_model(
5656
simple_metric_name = simple_metric_input.name
5757

5858
simple_metric_node = SimpleMetricNode.get_instance(simple_metric_name)
59-
# Add an edge from the measure node to the metric-time node.
59+
# Add an edge from the simple-metric input node to the metric-time node.
6060
edge_list.append(
6161
EntityRelationshipEdge.create(
6262
tail_node=simple_metric_node,
@@ -67,7 +67,7 @@ def _add_edges_for_simple_metric_model(
6767
),
6868
)
6969
)
70-
# Add an edge from the measure node to the model node.
70+
# Add an edge from the simple-metric input node to the model node.
7171
edge_list.append(
7272
EntityRelationshipEdge.create(
7373
tail_node=simple_metric_node,

metricflow-semantics/metricflow_semantics/experimental/semantic_graph/trie_resolver/group_by_metric_resolver.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959

6060
class GroupByMetricTrieResolver(DunderNameTrieResolver):
61-
"""Resolves the group-by metrics that are available for the given measures / metrics.
61+
"""Resolves the group-by metrics that are available for the given simple-metric inputs / metrics.
6262
6363
Group-by metrics are handled separately to break out the resolution of all available group-by items into smaller
6464
pieces.
@@ -203,7 +203,7 @@ def _resolve_trie(
203203
LazyFormat(
204204
"Valid group-by metrics for the given entity-key name not found. this may occur"
205205
" when a given entity is not accessible from any metric (known case is related to conversion"
206-
" measures)",
206+
" simple-metric inputs)",
207207
entity_key_name=entity_key_name,
208208
known_key_names=list(self._entity_key_name_to_metric_names.keys()),
209209
)
@@ -419,7 +419,7 @@ def generate(self) -> Mapping[str, MutableDunderNameTrie]:
419419
deny_labels = {
420420
# For metrics that require metric time to be in a query, it's not possible to query just the entity keys.
421421
DenyEntityKeyQueryResolutionLabel.get_instance(),
422-
# For conversion metrics, the conversion measure is effectively hidden and is not used to generate the
422+
# For conversion metrics, the conversion simple-metric input is effectively hidden and is not used to generate the
423423
# available group-by items for a metric.
424424
DenyVisibleAttributesLabel.get_instance(),
425425
}
@@ -441,7 +441,7 @@ def generate(self) -> Mapping[str, MutableDunderNameTrie]:
441441
if self._verbose_debug_logs:
442442
logger.debug(
443443
LazyFormat(
444-
"Found model nodes containing the measures for the given metric. Those model nodes"
444+
"Found model nodes containing the simple-metric inputs for the given metric. Those model nodes"
445445
" will be used for generating the available group-by items.",
446446
simple_metric_node=simple_metric_node,
447447
visible_source_model_nodes=visible_source_model_nodes,
@@ -469,7 +469,7 @@ def generate(self) -> Mapping[str, MutableDunderNameTrie]:
469469
if self._verbose_debug_logs:
470470
logger.debug(
471471
LazyFormat(
472-
"Found model nodes containing the measures for the given metric. Those model nodes"
472+
"Found model nodes containing the simple-metric inputs for the given metric. Those model nodes"
473473
" will be used for generating the available group-by items.",
474474
simple_metric_node=simple_metric_node,
475475
visible_source_model_nodes=visible_source_model_nodes,

metricflow-semantics/metricflow_semantics/experimental/semantic_graph/trie_resolver/simple_resolver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444

4545

4646
class SimpleTrieResolver(DunderNameTrieResolver):
47-
"""Resolves the dunder-name trie that represents the "simple" group-by items available for measures / metrics.
47+
"""Resolves the dunder-name trie that represents the "simple" group-by items available for metrics.
4848
49-
The set of simple group-by items does not include group-by metrics Those are handled in a separate resolver.
49+
The set of simple group-by items does not include group-by metrics. Those are handled in a separate resolver.
5050
"""
5151

5252
def __init__(
@@ -94,7 +94,7 @@ def _resolve_trie_for_source_nodes(
9494
the set of group-by items that are available for the source nodes is the intersection of the items that are
9595
available for each node.
9696
"""
97-
# Find the set measures / local-model nodes that the given source nodes depend on. Generating the result for
97+
# Find the set simple-metric inputs / local-model nodes that the given source nodes depend on. Generating the result for
9898
# the set of given source nodes requires intersecting the result produced from each node.
9999
find_descendants_result = self._path_finder.find_descendants(
100100
graph=self._semantic_graph,

metricflow-semantics/metricflow_semantics/instances.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def linkable_instances(self) -> Tuple[LinkableInstance, ...]: # noqa: D102
398398
)
399399

400400
def without_simple_metric_inputs(self) -> InstanceSet:
401-
"""Return a copy of this without the measure instances."""
401+
"""Return a copy of this without the simple-metric input instances."""
402402
return InstanceSet(
403403
simple_metric_input_instances=(),
404404
dimension_instances=self.dimension_instances,

metricflow-semantics/metricflow_semantics/model/dbt_manifest_parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ def parse_manifest_from_dbt_generated_manifest(manifest_json_string: str) -> Pyd
2121
"""Parse a PydanticSemanticManifest given the generated semantic_manifest json from dbt."""
2222
raw_model = PydanticSemanticManifest.parse_raw(manifest_json_string)
2323
# The serialized object in the dbt project does not have all transformations applied to it at
24-
# this time, which causes failures with input measure resolution.
24+
# this time, which causes failures with input simple-metric input resolution.
2525
# TODO: remove this transform call once the upstream changes are integrated into our dependency tree
2626
# TODO: align rules between DSI, here, and MFS (if possible!)
2727
rule_set = PydanticSemanticManifestTransformRuleSet()
2828
rules = (
2929
# Primary
3030
(LowerCaseNamesRule(),),
31-
# Secondary - broken out into groups because we run DedupeMetricInputMeasuresRule in the middle.
31+
# Secondary
3232
(
3333
*rule_set.legacy_measure_update_rules,
3434
# These individual rules come from rule_set.convert_legacy_measures_to_metrics_rules, but
35-
# dsi requØires AddInputMetricMeasuresRule, and metricflow requires that we do NOT run that rule
35+
# dsi requires AddInputMetricMeasuresRule, and metricflow requires that we do NOT run that rule
3636
# as it is incompatible with a parser like dbt-core that pre-populates input measures.
3737
CreateProxyMeasureRule(),
3838
FlattenSimpleMetricsWithMeasureInputsRule(),

metricflow-semantics/metricflow_semantics/model/semantics/linkable_element_set_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ class AnnotatedSpec(SerializableDataclass):
113113

114114
element_properties: Tuple[GroupByItemProperty, ...]
115115
# The semantic model(s) where the element (e.g. the categorical dimension) was defined.
116-
# There can be multiple models if it's a metric / derived metric that references multiple measures, and the join
117-
# path from the measure to the dimension is different.
116+
# There can be multiple models if it's a metric / derived metric that references multiple simple-metric inputs, and the join
117+
# path from the simple-metric input to the dimension is different.
118118
origin_semantic_model_names: Tuple[str, ...]
119119
derived_from_semantic_model_names: Tuple[str, ...]
120120

metricflow-semantics/metricflow_semantics/model/semantics/linkable_spec_resolver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
class GroupByItemSetResolver(ABC):
18-
"""Resolves available group-by items for measures and metrics."""
18+
"""Resolves available group-by items for simple-metric inputs and metrics."""
1919

2020
@abstractmethod
2121
def get_set_for_distinct_values_query(

metricflow-semantics/metricflow_semantics/model/semantics/semantic_model_join_evaluator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def get_valid_semantic_model_entity_join_type(
183183
# We cannot join two semantic models with validity dimensions due to concerns with unexpected fanout
184184
# due to the key structure of these semantic models. Applying multi-stage validity window filters can
185185
# also lead to unexpected removal of interim join keys. Note this will need to be updated if we enable
186-
# measures in such semantic models, since those will need to be converted to a different type of semantic model
186+
# simple-metric inputs in such semantic models, since those will need to be converted to a different type of semantic model
187187
# to support measure computation.
188188
return None
189189

0 commit comments

Comments
 (0)