#  Copyright (C) 2023
#  ABM, Moscow
#
#  UNPUBLISHED PROPRIETARY MATERIAL.
#  ALL RIGHTS RESERVED.
#
#  Authors: Vasiliev Ivan <i.vasiliev@technokert.ru>
from more_itertools import first

from clickhouse_tools.elements.abstract.selectable import Selectable
from clickhouse_tools.elements.column import Column


# TODO move to clickhouse tools
class Distinct(Selectable):
    def __init__(self, column: Column):
        super(Distinct, self).__init__(column.clickhouse_type, nullable=False, name=f"{column.name}_distinct")
        self.column=column

    def to_selector(self) -> str:
         return f"distinct({self.column.name})"

