Skip to content

Commit 3cfc344

Browse files
committed
feat(exasol): implement median and approx_median
1 parent ecbef94 commit 3cfc344

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

ibis/backends/sql/compilers/exasol.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class ExasolCompiler(SQLGlotCompiler):
3232

3333
UNSUPPORTED_OPS = (
3434
ops.AnalyticVectorizedUDF,
35-
ops.ApproxMedian,
3635
ops.ArgMax,
3736
ops.ArgMin,
3837
ops.ArrayDistinct,
@@ -56,7 +55,6 @@ class ExasolCompiler(SQLGlotCompiler):
5655
ops.IsInf,
5756
ops.IsNan,
5857
ops.Levenshtein,
59-
ops.Median,
6058
ops.MultiQuantile,
6159
ops.RandomUUID,
6260
ops.ReductionVectorizedUDF,
@@ -187,6 +185,11 @@ def visit_CountDistinctStar(self, op, *, arg, where):
187185
"COUNT(DISTINCT *) is not supported in Exasol"
188186
)
189187

188+
def visit_Median(self, op, *, arg, where):
189+
return self.visit_Quantile(op, arg=arg, quantile=sge.convert(0.5), where=where)
190+
191+
visit_ApproxMedian = visit_Median
192+
190193
def visit_Quantile(self, op, *, arg, quantile, where):
191194
suffix = "cont" if op.arg.dtype.is_numeric() else "disc"
192195
funcname = f"percentile_{suffix}"

ibis/backends/tests/test_aggregation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ def test_corr_cov(
11751175

11761176

11771177
@pytest.mark.notimpl(
1178-
["mysql", "sqlite", "mssql", "druid", "exasol"],
1178+
["mysql", "sqlite", "mssql", "druid"],
11791179
raises=com.OperationNotDefinedError,
11801180
)
11811181
@pytest.mark.notyet(["flink"], raises=com.OperationNotDefinedError)
@@ -1186,7 +1186,7 @@ def test_approx_median(alltypes):
11861186

11871187

11881188
@pytest.mark.notimpl(
1189-
["bigquery", "druid", "sqlite", "exasol"], raises=com.OperationNotDefinedError
1189+
["bigquery", "druid", "sqlite"], raises=com.OperationNotDefinedError
11901190
)
11911191
@pytest.mark.notyet(
11921192
["impala", "mysql", "mssql", "druid", "trino"],

0 commit comments

Comments
 (0)