Skip to content

Commit

Permalink
feat(bigquery): implement ops.Degrees, ops.Radians
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-kwitt authored and cpcloud committed Jan 4, 2023
1 parent 5495d6d commit 5119b93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ibis/backends/bigquery/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions ibis/backends/tests/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
],
Expand Down

0 comments on commit 5119b93

Please sign in to comment.