Skip to content

Commit a576cb7

Browse files
committed
feat: add arrow_cast function to cast expressions to specified data types
1 parent 1f434cc commit a576cb7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python/datafusion/functions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"array_to_string",
8383
"array_union",
8484
"arrow_typeof",
85+
"arrow_cast",
8586
"ascii",
8687
"asin",
8788
"asinh",
@@ -1099,6 +1100,11 @@ def arrow_typeof(arg: Expr) -> Expr:
10991100
return Expr(f.arrow_typeof(arg.expr))
11001101

11011102

1103+
def arrow_cast(expr: Expr, data_type: str) -> Expr:
1104+
"""Casts an expression to a specified data type."""
1105+
return Expr(f.arrow_cast(expr.expr, data_type))
1106+
1107+
11021108
def random() -> Expr:
11031109
"""Returns a random value in the range ``0.0 <= x < 1.0``."""
11041110
return Expr(f.random())

0 commit comments

Comments
 (0)