diff --git a/ibis/backends/base/sql/registry/main.py b/ibis/backends/base/sql/registry/main.py index 1d1e76b108c1..1aa753b4ede9 100644 --- a/ibis/backends/base/sql/registry/main.py +++ b/ibis/backends/base/sql/registry/main.py @@ -287,7 +287,9 @@ def count_star(translator, op): ops.Sin: unary("sin"), ops.Tan: unary("tan"), ops.Pi: fixed_arity("pi", 0), - ops.E: fixed_arity("exp(1)", 0), + ops.E: fixed_arity("e", 0), + ops.Degrees: lambda t, op: f"(180 * {t.translate(op.arg)} / {t.translate(ops.Pi())})", + ops.Radians: lambda t, op: f"({t.translate(ops.Pi())} * {t.translate(op.arg)} / 180)", # Unary aggregates ops.ApproxMedian: aggregate.reduction('appx_median'), ops.ApproxCountDistinct: aggregate.reduction('ndv'), @@ -354,7 +356,6 @@ def count_star(translator, op): ops.DateTruncate: timestamp.truncate, ops.IntervalFromInteger: timestamp.interval_from_integer, # Other operations - ops.E: lambda *args: 'e()', ops.Literal: literal, ops.NullLiteral: null_literal, ops.Cast: cast, diff --git a/ibis/backends/bigquery/registry.py b/ibis/backends/bigquery/registry.py index e9ecd2ccd9b0..6c590beafa1f 100644 --- a/ibis/backends/bigquery/registry.py +++ b/ibis/backends/bigquery/registry.py @@ -603,8 +603,6 @@ def _interval_multiply(t, op): ops.Floor: compiles_floor, ops.Modulus: fixed_arity("MOD", 2), ops.Sign: unary("SIGN"), - ops.Degrees: lambda t, op: f"(180 * {t.translate(op.arg)} / ACOS(-1))", - ops.Radians: lambda t, op: f"(ACOS(-1) * {t.translate(op.arg)} / 180)", ops.BitwiseNot: lambda t, op: f"~ {t.translate(op.arg)}", ops.BitwiseXor: lambda t, op: f"{t.translate(op.left)} ^ {t.translate(op.right)}", ops.BitwiseOr: lambda t, op: f"{t.translate(op.left)} | {t.translate(op.right)}", diff --git a/ibis/backends/tests/test_numeric.py b/ibis/backends/tests/test_numeric.py index 43480a0ccfc1..1afabaef2927 100644 --- a/ibis/backends/tests/test_numeric.py +++ b/ibis/backends/tests/test_numeric.py @@ -733,13 +733,11 @@ def test_isnan_isinf( L(5.556).radians(), math.radians(5.556), id='radians', - marks=pytest.mark.notimpl(["impala"], raises=com.OperationNotDefinedError), ), param( L(5.556).degrees(), math.degrees(5.556), id='degrees', - marks=pytest.mark.notimpl(["impala"], raises=com.OperationNotDefinedError), ), param(L(11) % 3, 11 % 3, id='mod'), ],