Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 93441277 authored by Bruno Guillon's avatar Bruno Guillon
Browse files

coalesce: use Coalesce class, handle pre_tuples

parent dcda3873
Branches
No related tags found
1 merge request!98Hotfix/coalesce
Pipeline #999826 passed
......@@ -142,8 +142,8 @@ class Column(Atom):
@columnize
@method_accepting_lambdas
def coalesce(self, *others):
return Transform("COALESCE", self.pretuple_with(*others))
def coalesce(self, *others, **kwargs):
return Coalesce(self.pretuple_with(*others), **kwargs)
def compress(self, *, unsafe=False):
"""Method to compress a column into an equivalent one
......@@ -928,8 +928,8 @@ class Pretuple(Expression, Generic[Col]):
sqltype = tuple((c.sqltype for c in columns))
super().__init__(columns=columns, sqltype=sqltype, **kwargs)
def coalesce(self, **kwargs):
return Coalesce(self, **kwargs)
def coalesce(self, *others, **kwargs):
return self.columns[0].__class__.coalesce(*self.columns, *others, **kwargs)
def to_placeholder(self, key: Optional[str | _MISSING_TYPE] = None) -> Placeholder:
raise NotImplementedError()
......@@ -972,6 +972,7 @@ class Pretuple(Expression, Generic[Col]):
@columnize
@method_accepting_lambdas
def pretuple_with(self, *others):
# TODO: Why not done as follows in Column class?
if not others:
return self
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment