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 63c20c0 commit 7ead7c7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 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
18 changes: 6 additions & 12 deletions ibis/backends/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,7 @@ def test_table_info_large(con):
reason="quantile and mode is not supported",
)
@pytest.mark.notimpl(
[
"exasol",
"druid",
],
["druid"],
raises=com.OperationNotDefinedError,
reason="Mode and StandardDev is not supported",
)
Expand Down Expand Up @@ -829,10 +826,10 @@ def test_table_info_large(con):
pytest.mark.notimpl(
[
"clickhouse",
"exasol",
"impala",
"pyspark",
"clickhouse",
"risingwave",
"impala",
],
raises=com.OperationNotDefinedError,
reason="mode is not supported",
Expand Down Expand Up @@ -911,10 +908,10 @@ def test_table_info_large(con):
pytest.mark.notimpl(
[
"clickhouse",
"exasol",
"impala",
"pyspark",
"clickhouse",
"risingwave",
"impala",
],
raises=com.OperationNotDefinedError,
reason="mode is not supported",
Expand Down Expand Up @@ -958,10 +955,7 @@ def test_table_describe(alltypes, selector, expected_columns):
reason="quantile is not supported",
)
@pytest.mark.notimpl(
[
"exasol",
"druid",
],
["druid"],
raises=com.OperationNotDefinedError,
reason="StandardDev is not supported",
)
Expand Down

0 comments on commit 7ead7c7

Please sign in to comment.