You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(skills): make-pythonic also targets functions.spark
Previous guidance said to skip the spark namespace entirely. That was
wrong: the spark namespace should also feel pythonic — it just carries
the extra constraint that every signature must remain compatible with
pyspark.sql.functions (parameter names, positional order, accepted input
types). Pythonic widenings like `Expr → Expr | int` are on-brand there
because pyspark itself accepts the int form.
Rewrite the scope section to spell out the compatibility rules (keep
parameter names/order; widen input types, never narrow; extra kwargs
default to None) and extend "How to Identify Candidates" to include
`functions/spark.py`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Practical effect: in `functions.spark`, apply Categories A and (where
60
+
pyspark exposes the same arg as a non-`Expr`) B normally, but cross-check
61
+
each proposed signature against `pyspark.sql.functions` before landing
62
+
it. When pyspark's own type hint is `Column | str` for a "column name"
63
+
arg, prefer leaving the spark wrapper at `Expr` — Category C
64
+
("`Expr | str` meaning column name") is unusual in `functions.py` and
65
+
should remain so in `functions.spark`.
52
66
53
67
## How to Identify Candidates
54
68
55
-
The user may specify a scope via `$ARGUMENTS`. If no scope is given or "all" is specified, audit all functions in `python/datafusion/functions/__init__.py`.
69
+
The user may specify a scope via `$ARGUMENTS`. If no scope is given or "all" is specified, audit all functions in `python/datafusion/functions/__init__.py`**and**`python/datafusion/functions/spark.py`. When updating a spark-namespace function, apply the compatibility rules from "Scope" above on top of the standard analysis.
56
70
57
71
For each function, determine if any parameter can accept native Python types by evaluating **two complementary signals**:
0 commit comments