Skip to content

Commit

Permalink
feat(exasol): implement Table.nunique
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Aug 19, 2024
1 parent dab7330 commit a4a8e4b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 5 additions & 3 deletions ibis/backends/sql/compilers/exasol.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,11 @@ def visit_CountStar(self, op, *, arg, where):
return self.f.count(STAR)

def visit_CountDistinctStar(self, op, *, arg, where):
raise com.UnsupportedOperationError(
"COUNT(DISTINCT *) is not supported in Exasol"
)
cols = [sg.column(k, quoted=self.quoted) for k in op.arg.schema.keys()]
if where is not None:
cols = [self.if_(where, c, NULL) for c in cols]
row = sge.Tuple(expressions=cols)
return self.f.count(sge.Distinct(expressions=[row]))

def visit_TimestampTruncate(self, op, *, arg, unit):
short_name = unit.short
Expand Down
1 change: 0 additions & 1 deletion ibis/backends/tests/test_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,6 @@ def test_arbitrary(backend, alltypes, df, filtered):
raises=com.OperationNotDefinedError,
reason="no one has attempted implementation yet",
)
@pytest.mark.notimpl(["exasol"], raises=com.UnsupportedOperationError)
def test_count_distinct_star(alltypes, df, ibis_cond, pandas_cond):
table = alltypes[["int_col", "double_col", "string_col"]]
expr = table.nunique(where=ibis_cond(table))
Expand Down

0 comments on commit a4a8e4b

Please sign in to comment.