Skip to content

Commit 9ee910d

Browse files
authored
feat(oracle): implement mode aggregation (#9914)
1 parent 4d8d352 commit 9ee910d

File tree

3 files changed

+11
-54
lines changed

3 files changed

+11
-54
lines changed

ibis/backends/sql/compilers/oracle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class OracleCompiler(SQLGlotCompiler):
5757
ops.ArrayFlatten,
5858
ops.ArrayMap,
5959
ops.ArrayStringJoin,
60-
ops.Mode,
6160
ops.MultiQuantile,
6261
ops.RegexSplit,
6362
ops.StringSplit,
@@ -89,6 +88,7 @@ class OracleCompiler(SQLGlotCompiler):
8988
ops.RPad: "rpad",
9089
ops.StringAscii: "ascii",
9190
ops.Strip: "trim",
91+
ops.Mode: "stats_mode",
9292
}
9393

9494
@staticmethod

ibis/backends/tests/test_aggregation.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ def mean_udf(s):
9393
"pyspark",
9494
"trino",
9595
"druid",
96-
"oracle",
9796
"flink",
9897
"risingwave",
9998
"exasol",
@@ -391,7 +390,6 @@ def mean_and_std(v):
391390
"mssql",
392391
"trino",
393392
"druid",
394-
"oracle",
395393
"exasol",
396394
"flink",
397395
"risingwave",

ibis/backends/tests/test_generic.py

Lines changed: 10 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ def test_order_by_two_cols_nulls(con, op1, nf1, nf2, op2, expected):
715715
getattr(t["col2"], op2)(nulls_first=nf2),
716716
)
717717

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

770770

771771
@pytest.mark.notimpl(
772-
[
773-
"datafusion",
774-
"bigquery",
775-
"impala",
776-
"mysql",
777-
"mssql",
778-
"trino",
779-
"flink",
780-
],
772+
["datafusion", "bigquery", "impala", "mysql", "mssql", "trino", "flink"],
781773
raises=com.OperationNotDefinedError,
782774
reason="quantile and mode is not supported",
783775
)
784-
@pytest.mark.notimpl(
785-
["druid"],
786-
raises=com.OperationNotDefinedError,
787-
reason="Mode and StandardDev is not supported",
788-
)
776+
@pytest.mark.notimpl(["druid"], raises=com.OperationNotDefinedError)
789777
@pytest.mark.notyet(
790778
["druid"],
791779
raises=PyDruidProgrammingError,
@@ -895,31 +883,17 @@ def test_table_info_large(con):
895883
),
896884
param(
897885
s.of_type("string"),
898-
[
899-
"name",
900-
"pos",
901-
"type",
902-
"count",
903-
"nulls",
904-
"unique",
905-
"mode",
906-
],
886+
["name", "pos", "type", "count", "nulls", "unique", "mode"],
907887
marks=[
908888
pytest.mark.notimpl(
909-
[
910-
"clickhouse",
911-
"exasol",
912-
"impala",
913-
"pyspark",
914-
"risingwave",
915-
],
889+
["clickhouse", "exasol", "impala", "pyspark", "risingwave"],
916890
raises=com.OperationNotDefinedError,
917891
reason="mode is not supported",
918892
),
919893
pytest.mark.notimpl(
920894
["oracle"],
921-
raises=com.OperationNotDefinedError,
922-
reason="Mode is not supported and ORA-02000: missing AS keyword",
895+
raises=OracleDatabaseError,
896+
reason="ORA-02000: missing AS keyword",
923897
),
924898
pytest.mark.notimpl(
925899
["dask"],
@@ -941,33 +915,18 @@ def test_table_describe(alltypes, selector, expected_columns):
941915

942916

943917
@pytest.mark.notimpl(
944-
[
945-
"datafusion",
946-
"bigquery",
947-
"impala",
948-
"mysql",
949-
"mssql",
950-
"trino",
951-
"flink",
952-
"sqlite",
953-
],
918+
["datafusion", "bigquery", "impala", "mysql", "mssql", "trino", "flink", "sqlite"],
954919
raises=com.OperationNotDefinedError,
955920
reason="quantile is not supported",
956921
)
957-
@pytest.mark.notimpl(
958-
["druid"],
959-
raises=com.OperationNotDefinedError,
960-
reason="StandardDev is not supported",
961-
)
922+
@pytest.mark.notimpl(["druid"], raises=com.OperationNotDefinedError)
962923
@pytest.mark.notyet(
963924
["druid"],
964925
raises=PyDruidProgrammingError,
965926
reason="Druid only supports trivial unions",
966927
)
967928
@pytest.mark.notyet(
968-
["oracle"],
969-
raises=OracleDatabaseError,
970-
reason="Mode is not supported and ORA-02000: missing AS keyword",
929+
["oracle"], raises=OracleDatabaseError, reason="ORA-02000: missing AS keyword"
971930
)
972931
def test_table_describe_large(con):
973932
num_cols = 129

0 commit comments

Comments
 (0)