Skip to content

Commit 25cb8e2

Browse files
timsaucerclaude
andcommitted
docs: point cast_to_type at arrow_cast for static target types
Adds a one-line cross-reference so users with a known target type reach for arrow_cast / arrow_try_cast instead of building a sentinel expression to feed cast_to_type. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ce83065 commit 25cb8e2

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

python/datafusion/functions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2996,6 +2996,10 @@ def cast_to_type(value: Expr, type_ref: Expr, *, try_cast: bool = False) -> Expr
29962996
rather than being known up-front. When ``try_cast=True``, casts that
29972997
fail produce NULL instead of erroring.
29982998
2999+
If the target type is known statically, prefer :py:func:`arrow_cast`
3000+
(or :py:func:`arrow_try_cast` for the NULL-on-failure variant) and
3001+
pass a type string or ``pyarrow.DataType`` directly.
3002+
29993003
Examples:
30003004
>>> ctx = dfn.SessionContext()
30013005
>>> df = ctx.from_pydict({"a": [1], "b": [1.0]})

0 commit comments

Comments
 (0)