Skip to content

Commit

Permalink
feat(datafusion): implement ops.Pi, ops.E
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-kwitt authored and cpcloud committed Feb 16, 2023
1 parent 4193867 commit 5a74cb4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions ibis/backends/datafusion/compiler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import functools
import math
import operator

import datafusion as df
Expand Down Expand Up @@ -423,6 +424,16 @@ def cot(op):
return df.lit(1.0) / df.functions.tan(x)


@translate.register(ops.Pi)
def pi(_):
return df.lit(math.pi)


@translate.register(ops.E)
def e(_):
return df.lit(math.e)


@translate.register(ops.ElementWiseVectorizedUDF)
def elementwise_udf(op):
udf = df.udf(
Expand Down
1 change: 0 additions & 1 deletion ibis/backends/tests/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,6 @@ def test_histogram(con, alltypes):
assert len(results.value_counts()) == n


@pytest.mark.notimpl(["datafusion"], raises=com.OperationNotDefinedError)
@pytest.mark.parametrize("const", ["e", "pi"])
def test_constants(con, const):
expr = getattr(ibis, const)
Expand Down

0 comments on commit 5a74cb4

Please sign in to comment.