From 631885a75299d8bc76958bd4505011e209675c08 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Tue, 9 Jul 2024 10:11:55 -0700 Subject: [PATCH] /* PR_START p--query-resolution-perf 15 */ Remove unnecessary deepcopy. --- .../model/semantics/semantic_model_lookup.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/metricflow-semantics/metricflow_semantics/model/semantics/semantic_model_lookup.py b/metricflow-semantics/metricflow_semantics/model/semantics/semantic_model_lookup.py index df32102085..59931b2090 100644 --- a/metricflow-semantics/metricflow_semantics/model/semantics/semantic_model_lookup.py +++ b/metricflow-semantics/metricflow_semantics/model/semantics/semantic_model_lookup.py @@ -1,7 +1,6 @@ from __future__ import annotations import logging -from copy import deepcopy from typing import Dict, List, Optional, Sequence, Set from dbt_semantic_interfaces.protocols.dimension import Dimension @@ -92,13 +91,11 @@ def get_dimension(self, dimension_reference: DimensionReference) -> Dimension: f"Could not find dimension with name '{dimension_reference.element_name}' in configured semantic models" ) - dimension = SemanticModelLookup.get_dimension_from_semantic_model( + return SemanticModelLookup.get_dimension_from_semantic_model( # Dimension object should match across semantic models, so just use the first semantic model. semantic_model=semantic_models[0], dimension_reference=dimension_reference, ) - # TODO: Unclear if the deepcopy is necessary. - return deepcopy(dimension) def get_time_dimension(self, time_dimension_reference: TimeDimensionReference) -> Dimension: """Retrieves a full dimension object by name."""