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 6be390b commit 49b66e2
Show file tree
Hide file tree
Showing 2 changed files with 6 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 @@ -189,9 +189,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_Median(self, op, *, arg, where):
return self.visit_Quantile(op, arg=arg, quantile=sge.convert(0.5), where=where)
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/tests/test_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ibis import literal as L
from ibis.backends.tests.errors import (
ClickHouseDatabaseError,
ExaQueryError,
GoogleBadRequest,
ImpalaHiveServer2Error,
MySQLNotSupportedError,
Expand Down Expand Up @@ -790,7 +791,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 49b66e2

Please sign in to comment.