From 5119b93609f34035ced2ccc784190b0cb4a15a39 Mon Sep 17 00:00:00 2001 From: Krzysztof Date: Wed, 4 Jan 2023 04:13:40 +0100 Subject: [PATCH] feat(bigquery): implement ops.Degrees, ops.Radians --- ibis/backends/bigquery/registry.py | 2 ++ ibis/backends/tests/test_numeric.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ibis/backends/bigquery/registry.py b/ibis/backends/bigquery/registry.py index 7ae739a72519..30130a33b1a0 100644 --- a/ibis/backends/bigquery/registry.py +++ b/ibis/backends/bigquery/registry.py @@ -546,6 +546,8 @@ def _clip(t, op): ops.Modulus: fixed_arity("MOD", 2), ops.Sign: unary("SIGN"), ops.Clip: _clip, + 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)", # Temporal functions ops.Date: unary("DATE"), ops.DateFromYMD: fixed_arity("DATE", 3), diff --git a/ibis/backends/tests/test_numeric.py b/ibis/backends/tests/test_numeric.py index be509bd15fe9..32e8f26a580f 100644 --- a/ibis/backends/tests/test_numeric.py +++ b/ibis/backends/tests/test_numeric.py @@ -163,13 +163,13 @@ def test_isnan_isinf( L(5.556).radians(), math.radians(5.556), id='radians', - marks=pytest.mark.notimpl(["bigquery", "datafusion", "impala"]), + marks=pytest.mark.notimpl(["datafusion", "impala"]), ), param( L(5.556).degrees(), math.degrees(5.556), id='degrees', - marks=pytest.mark.notimpl(["bigquery", "datafusion", "impala"]), + marks=pytest.mark.notimpl(["datafusion", "impala"]), ), param(L(11) % 3, 11 % 3, id='mod'), ],