Skip to content

Commit

Permalink
Remove custom merge_iterable.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed Dec 13, 2024
1 parent 7d1eff2 commit 42cbd67
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions metricflow/sql/sql_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
from abc import ABC, abstractmethod
from dataclasses import dataclass
from enum import Enum
from typing import Dict, Generic, Iterable, List, Mapping, Optional, Sequence, Tuple
from typing import Dict, Generic, List, Mapping, Optional, Sequence, Tuple

import more_itertools
from dbt_semantic_interfaces.enum_extension import assert_values_exhausted
from dbt_semantic_interfaces.protocols.measure import MeasureAggregationParameters
from dbt_semantic_interfaces.type_enums.aggregation_type import AggregationType
Expand Down Expand Up @@ -110,20 +109,6 @@ class SqlExpressionTreeLineage(Mergeable):
column_alias_reference_exprs: Tuple[SqlColumnAliasReferenceExpression, ...] = ()
other_exprs: Tuple[SqlExpressionNode, ...] = ()

@classmethod
@override
def merge_iterable(cls, items: Iterable[SqlExpressionTreeLineage]) -> SqlExpressionTreeLineage:
"""Combine multiple lineages into one lineage, without de-duping."""
return SqlExpressionTreeLineage(
string_exprs=tuple(more_itertools.flatten(tuple(x.string_exprs for x in items))),
function_exprs=tuple(more_itertools.flatten(tuple(x.function_exprs for x in items))),
column_reference_exprs=tuple(more_itertools.flatten(tuple(x.column_reference_exprs for x in items))),
column_alias_reference_exprs=tuple(
more_itertools.flatten(tuple(x.column_alias_reference_exprs for x in items))
),
other_exprs=tuple(more_itertools.flatten(tuple(x.other_exprs for x in items))),
)

@property
def contains_string_exprs(self) -> bool: # noqa: D102
return len(self.string_exprs) > 0
Expand Down

0 comments on commit 42cbd67

Please sign in to comment.