class_docstr: Container class for storing all linkable elements for a metric.
  
  TODO: There are similarities with LinkableSpecSet - consider consolidation.
docstr: Combine multiple sets together by the path key.
  
  If there are elements with the same join key, those elements will be categorized as ambiguous.
docstr_tok: ["Combine","multiple","sets","together","by","the","path","key",".","If","there","are","elements","with","the","same","join","key",",","those","elements","will","be","categorized","as","ambiguous","."]
code: def merge_by_path_key(
      linkable_element_sets: Sequence[LinkableElementSet],
  ) -> LinkableElementSet:
      """Combine multiple sets together by the path key.
  
      If there are elements with the same join key, those elements will be categorized as ambiguous.
      """
      key_to_linkable_dimensions: Dict[
          ElementPathKey, List[LinkableDimension]
      ] = defaultdict(list)
      key_to_linkable_entities: Dict[
          ElementPathKey, List[LinkableEntity]
      ] = defaultdict(list)
  
      for linkable_element_set in linkable_element_sets:
          for (
              path_key,
              linkable_dimensions,
          ) in (
              linkable_element_set.path_key_to_linkable_dimensions.items()
          ):
              key_to_linkable_dimensions[path_key].extend(
                  linkable_dimensions
              )
          for (
              path_key,
              linkable_entities,
          ) in (
              linkable_element_set.path_key_to_linkable_entities.items()
          ):
              key_to_linkable_entities[path_key].extend(
                  linkable_entities
              )
  
      # Convert the dictionaries to use tuples instead of lists.
      return LinkableElementSet(
          path_key_to_linkable_dimensions={
              path_key: tuple(dimensions)
              for path_key, dimensions in key_to_linkable_dimensions.items()
          },
          path_key_to_linkable_entities={
              path_key: tuple(entities)
              for path_key, entities in key_to_linkable_entities.items()
          },
      )
  
imports: from __future__ import annotations
  import logging
  import time
  from collections import defaultdict
  from dataclasses import dataclass
  from typing import Dict, FrozenSet, List, Optional, Sequence, Set, Tuple
  from dbt_semantic_interfaces.enum_extension import assert_values_exhausted
  from dbt_semantic_interfaces.pretty_print import pformat_big_objects
  from dbt_semantic_interfaces.protocols.dimension import Dimension, DimensionType
  from dbt_semantic_interfaces.protocols.semantic_manifest import SemanticManifest
  from dbt_semantic_interfaces.protocols.semantic_model import SemanticModel
  from dbt_semantic_interfaces.references import DimensionReference, MeasureReference, MetricReference, SemanticModelReference, TimeDimensionReference
  from dbt_semantic_interfaces.type_enums import MetricType
  from dbt_semantic_interfaces.type_enums.date_part import DatePart
  from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity
  from metricflow.dataset.dataset import DataSet
  from metricflow.errors.errors import UnknownMetricLinkingError
  from metricflow.model.semantics.linkable_element_properties import LinkableElementProperties
  from metricflow.model.semantics.semantic_model_join_evaluator import SemanticModelJoinEvaluator
  from metricflow.model.semantics.semantic_model_lookup import SemanticModelLookup
  from metricflow.protocols.semantics import SemanticModelAccessor
  from metricflow.specs.specs import DEFAULT_TIME_GRANULARITY, DimensionSpec, EntityReference, EntitySpec, LinkableSpecSet, TimeDimensionSpec
label_desc: Use image node_id 1 for calling the LinkableElementSet obj's underlying member method code with example usage: obj.merge_by_path_key(linkable_element_sets) and returns: LinkableElementSet