Skip to content

Commit

Permalink
refactor(sql-compiler): pull up argmin and argmax into the base compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Nov 2, 2024
1 parent 9b7a377 commit ef6634c
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ class SQLGlotCompiler(abc.ABC):
ops.ArrayLength: "array_size",
ops.ArraySort: "array_sort",
ops.ArrayStringJoin: "array_to_string",
ops.ArgMax: "max_by",
ops.ArgMin: "min_by",
ops.Asin: "asin",
ops.Atan2: "atan2",
ops.Atan: "atan",
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/druid.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class DruidCompiler(SQLGlotCompiler):
ops.ArraySort,
ops.ArrayUnion,
ops.ArrayZip,
ops.ArgMax,
ops.ArgMin,
ops.CountDistinctStar,
ops.Covariance,
ops.Date,
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/exasol.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class ExasolCompiler(SQLGlotCompiler):
ops.ArrayStringJoin,
ops.ArrayUnion,
ops.ArrayZip,
ops.ArgMax,
ops.ArgMin,
ops.BitwiseNot,
ops.CumeDist,
ops.DateAdd,
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/flink.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class FlinkCompiler(SQLGlotCompiler):
ops.ApproxMedian,
ops.ArrayFlatten,
ops.ArrayStringJoin,
ops.ArgMax,
ops.ArgMin,
ops.Correlation,
ops.CountDistinctStar,
ops.Covariance,
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/impala.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class ImpalaCompiler(SQLGlotCompiler):
UNSUPPORTED_OPS = (
ops.ArrayPosition,
ops.Array,
ops.ArgMax,
ops.ArgMin,
ops.Covariance,
ops.ExtractDayOfYear,
ops.Levenshtein,
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class MSSQLCompiler(SQLGlotCompiler):
ops.ArrayMap,
ops.ArraySort,
ops.ArrayUnion,
ops.ArgMax,
ops.ArgMin,
ops.BitAnd,
ops.BitOr,
ops.BitXor,
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def POS_INF(self):
ops.Array,
ops.ArrayFlatten,
ops.ArrayMap,
ops.ArgMax,
ops.ArgMin,
ops.Covariance,
ops.Levenshtein,
ops.Median,
Expand Down
2 changes: 2 additions & 0 deletions ibis/backends/sql/compilers/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class OracleCompiler(SQLGlotCompiler):
ops.ArrayFlatten,
ops.ArrayMap,
ops.ArrayStringJoin,
ops.ArgMax,
ops.ArgMin,
ops.MultiQuantile,
ops.RegexSplit,
ops.StringSplit,
Expand Down
2 changes: 0 additions & 2 deletions ibis/backends/sql/compilers/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ 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

0 comments on commit ef6634c

Please sign in to comment.