Skip to content

Commit

Permalink
feat(oracle): implement mode aggregation (#9914)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored Sep 3, 2024
1 parent 4d8d352 commit 9ee910d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 54 deletions.
2 changes: 1 addition & 1 deletion ibis/backends/sql/compilers/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class OracleCompiler(SQLGlotCompiler):
ops.ArrayFlatten,
ops.ArrayMap,
ops.ArrayStringJoin,
ops.Mode,
ops.MultiQuantile,
ops.RegexSplit,
ops.StringSplit,
Expand Down Expand Up @@ -89,6 +88,7 @@ class OracleCompiler(SQLGlotCompiler):
ops.RPad: "rpad",
ops.StringAscii: "ascii",
ops.Strip: "trim",
ops.Mode: "stats_mode",
}

@staticmethod
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/tests/test_aggregation.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ def mean_udf(s):
"pyspark",
"trino",
"druid",
"oracle",
"flink",
"risingwave",
"exasol",
Expand Down Expand Up @@ -391,7 +390,6 @@ def mean_and_std(v):
"mssql",
"trino",
"druid",
"oracle",
"exasol",
"flink",
"risingwave",
Expand Down
61 changes: 10 additions & 51 deletions ibis/backends/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def test_order_by_two_cols_nulls(con, op1, nf1, nf2, op2, expected):
getattr(t["col2"], op2)(nulls_first=nf2),
)

if (con.name in ("pandas", "dask")) and (nf1 != nf2):
if con.name in ("pandas", "dask") and nf1 != nf2:
with pytest.raises(
ValueError,
match=f"{con.name} does not support specifying null ordering for individual column",
Expand Down Expand Up @@ -769,23 +769,11 @@ def test_table_info_large(con):


@pytest.mark.notimpl(
[
"datafusion",
"bigquery",
"impala",
"mysql",
"mssql",
"trino",
"flink",
],
["datafusion", "bigquery", "impala", "mysql", "mssql", "trino", "flink"],
raises=com.OperationNotDefinedError,
reason="quantile and mode is not supported",
)
@pytest.mark.notimpl(
["druid"],
raises=com.OperationNotDefinedError,
reason="Mode and StandardDev is not supported",
)
@pytest.mark.notimpl(["druid"], raises=com.OperationNotDefinedError)
@pytest.mark.notyet(
["druid"],
raises=PyDruidProgrammingError,
Expand Down Expand Up @@ -895,31 +883,17 @@ def test_table_info_large(con):
),
param(
s.of_type("string"),
[
"name",
"pos",
"type",
"count",
"nulls",
"unique",
"mode",
],
["name", "pos", "type", "count", "nulls", "unique", "mode"],
marks=[
pytest.mark.notimpl(
[
"clickhouse",
"exasol",
"impala",
"pyspark",
"risingwave",
],
["clickhouse", "exasol", "impala", "pyspark", "risingwave"],
raises=com.OperationNotDefinedError,
reason="mode is not supported",
),
pytest.mark.notimpl(
["oracle"],
raises=com.OperationNotDefinedError,
reason="Mode is not supported and ORA-02000: missing AS keyword",
raises=OracleDatabaseError,
reason="ORA-02000: missing AS keyword",
),
pytest.mark.notimpl(
["dask"],
Expand All @@ -941,33 +915,18 @@ def test_table_describe(alltypes, selector, expected_columns):


@pytest.mark.notimpl(
[
"datafusion",
"bigquery",
"impala",
"mysql",
"mssql",
"trino",
"flink",
"sqlite",
],
["datafusion", "bigquery", "impala", "mysql", "mssql", "trino", "flink", "sqlite"],
raises=com.OperationNotDefinedError,
reason="quantile is not supported",
)
@pytest.mark.notimpl(
["druid"],
raises=com.OperationNotDefinedError,
reason="StandardDev is not supported",
)
@pytest.mark.notimpl(["druid"], raises=com.OperationNotDefinedError)
@pytest.mark.notyet(
["druid"],
raises=PyDruidProgrammingError,
reason="Druid only supports trivial unions",
)
@pytest.mark.notyet(
["oracle"],
raises=OracleDatabaseError,
reason="Mode is not supported and ORA-02000: missing AS keyword",
["oracle"], raises=OracleDatabaseError, reason="ORA-02000: missing AS keyword"
)
def test_table_describe_large(con):
num_cols = 129
Expand Down

0 comments on commit 9ee910d

Please sign in to comment.