Skip to content

Commit 401baa7

Browse files
committed
Remove builtins
1 parent 66f1a04 commit 401baa7

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

python/datafusion/functions.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -678,14 +678,11 @@ def cot(arg: Expr) -> Expr:
678678
>>> from math import pi
679679
>>> ctx = dfn.SessionContext()
680680
>>> df = ctx.from_pydict({"a": [pi / 4]})
681-
>>> import builtins
682681
>>> result = df.select(
683682
... dfn.functions.cot(dfn.col("a")).alias("cot")
684683
... )
685-
>>> builtins.round(
686-
... result.collect_column("cot")[0].as_py(), 1
687-
... )
688-
1.0
684+
>>> result.collect_column("cot")[0].as_py()
685+
1.0...
689686
"""
690687
return Expr(f.cot(arg.expr))
691688

@@ -886,14 +883,11 @@ def radians(arg: Expr) -> Expr:
886883
>>> from math import pi
887884
>>> ctx = dfn.SessionContext()
888885
>>> df = ctx.from_pydict({"a": [180.0]})
889-
>>> import builtins
890886
>>> result = df.select(
891887
... dfn.functions.radians(dfn.col("a")).alias("rad")
892888
... )
893-
>>> builtins.round(
894-
... result.collect_column("rad")[0].as_py(), 6
895-
... )
896-
3.141593
889+
>>> result.collect_column("rad")[0].as_py()
890+
3.14159...
897891
"""
898892
return Expr(f.radians(arg.expr))
899893

@@ -3035,18 +3029,15 @@ def cume_dist(
30353029
Examples:
30363030
---------
30373031
>>> ctx = dfn.SessionContext()
3038-
>>> df = ctx.from_pydict({"a": [10, 10, 20]})
3039-
>>> import builtins
3032+
>>> df = ctx.from_pydict({"a": [1., 2., 2., 3.]})
30403033
>>> result = df.select(
30413034
... dfn.col("a"),
30423035
... dfn.functions.cume_dist(
30433036
... order_by="a"
30443037
... ).alias("cd")
30453038
... )
3046-
>>> [builtins.round(x, 4) for x in
3047-
... result.sort(dfn.col("a")
3048-
... ).collect_column("cd").to_pylist()]
3049-
[0.6667, 0.6667, 1.0]
3039+
>>> result.collect_column("cd").to_pylist()
3040+
[0.25..., 0.75..., 0.75..., 1.0...]
30503041
"""
30513042
partition_by_raw = expr_list_to_raw_expr_list(partition_by)
30523043
order_by_raw = sort_list_to_raw_sort_list(order_by)

0 commit comments

Comments
 (0)