Skip to content

Commit 83dca2e

Browse files
timsaucerclaude
andcommitted
docs: assert full struct shape in arrow_field doctest
Previous doctest set metadata on the input field but only checked the name — the metadata setup was dead. Now the example asserts the full returned struct (name, data_type, nullable, metadata) so the demo shows what the function actually produces. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 708cd4d commit 83dca2e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

python/datafusion/functions.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2981,8 +2981,9 @@ def arrow_field(expr: Expr) -> Expr:
29812981
>>> result = df.select(
29822982
... dfn.functions.arrow_field(dfn.col("val")).alias("f")
29832983
... )
2984-
>>> result.collect_column("f")[0].as_py()["name"]
2985-
'val'
2984+
>>> out = result.collect_column("f")[0].as_py()
2985+
>>> out["name"], out["data_type"], out["nullable"], out["metadata"]
2986+
('val', 'Int64', True, [('k', 'v')])
29862987
"""
29872988
return Expr(f.arrow_field(expr.expr))
29882989

0 commit comments

Comments
 (0)