Skip to content

Commit

Permalink
refactor(sql): don't implement argmin/argmax on the base compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Sep 25, 2024
1 parent 3310220 commit 7c953b9
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 16 deletions.
2 changes: 0 additions & 2 deletions ibis/backends/sql/compilers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ class SQLGlotCompiler(abc.ABC):
ops.All: "bool_and",
ops.Any: "bool_or",
ops.ApproxCountDistinct: "approx_distinct",
ops.ArgMax: "max_by",
ops.ArgMin: "min_by",
ops.ArrayContains: "array_contains",
ops.ArrayFlatten: "flatten",
ops.ArrayLength: "array_size",
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/sql/compilers/druid.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class DruidCompiler(SQLGlotCompiler):

UNSUPPORTED_OPS = (
ops.ApproxMedian,
ops.ArgMax,
ops.ArgMin,
ops.ArrayDistinct,
ops.ArrayFilter,
ops.ArrayFlatten,
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/sql/compilers/exasol.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class ExasolCompiler(SQLGlotCompiler):

UNSUPPORTED_OPS = (
ops.AnalyticVectorizedUDF,
ops.ArgMax,
ops.ArgMin,
ops.ArrayDistinct,
ops.ArrayFilter,
ops.ArrayFlatten,
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/sql/compilers/flink.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ class FlinkCompiler(SQLGlotCompiler):
UNSUPPORTED_OPS = (
ops.AnalyticVectorizedUDF,
ops.ApproxMedian,
ops.ArgMax,
ops.ArgMin,
ops.ArrayFlatten,
ops.ArrayStringJoin,
ops.Correlation,
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/sql/compilers/impala.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ class ImpalaCompiler(SQLGlotCompiler):
}

UNSUPPORTED_OPS = (
ops.ArgMax,
ops.ArgMin,
ops.ArrayPosition,
ops.Array,
ops.Covariance,
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/sql/compilers/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ class MSSQLCompiler(SQLGlotCompiler):

UNSUPPORTED_OPS = (
ops.ApproxMedian,
ops.ArgMax,
ops.ArgMin,
ops.Array,
ops.ArrayDistinct,
ops.ArrayFlatten,
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/sql/compilers/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ def POS_INF(self):
NEG_INF = POS_INF
UNSUPPORTED_OPS = (
ops.ApproxMedian,
ops.ArgMax,
ops.ArgMin,
ops.Array,
ops.ArrayFlatten,
ops.ArrayMap,
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/sql/compilers/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ class OracleCompiler(SQLGlotCompiler):
}

UNSUPPORTED_OPS = (
ops.ArgMax,
ops.ArgMin,
ops.Array,
ops.ArrayFlatten,
ops.ArrayMap,
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/pyspark.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ class PySparkCompiler(SQLGlotCompiler):
}

SIMPLE_OPS = {
ops.ArgMax: "max_by",
ops.ArgMin: "min_by",
ops.ArrayDistinct: "array_distinct",
ops.ArrayFlatten: "flatten",
ops.ArrayIntersect: "array_intersect",
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class SnowflakeCompiler(SQLGlotCompiler):
SIMPLE_OPS = {
ops.All: "min",
ops.Any: "max",
ops.ArgMax: "max_by",
ops.ArgMin: "min_by",
ops.ArrayDistinct: "array_distinct",
ops.ArrayFlatten: "array_flatten",
ops.ArrayIndex: "get",
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class TrinoCompiler(SQLGlotCompiler):

SIMPLE_OPS = {
ops.Arbitrary: "any_value",
ops.ArgMax: "max_by",
ops.ArgMin: "min_by",
ops.Pi: "pi",
ops.E: "e",
ops.RegexReplace: "regexp_replace",
Expand Down

0 comments on commit 7c953b9

Please sign in to comment.