Skip to content

feat(oracle): implement mode aggregation #9914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still an issue with using mode in describe, but at least now users can call mode outside of that context. I'm not entirely sure why mode isn't working in describe.

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