Uh oh!
There was an error while loading. Please reload this page.
[SPARK-58087][PYTHON][DOCS] Document accepted input and return types in the PySpark functions API - #57185
[SPARK-58087][PYTHON][DOCS] Document accepted input and return types in the PySpark functions API#57185HyukjinKwon wants to merge 7 commits into
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
HyukjinKwon
commented
Jul 10, 2026
Thank you @dongjoon-hyun for review. Let me try to take a look throughoutly. |
241f910 to
d9b102bCompareUh oh!
There was an error while loading. Please reload this page.
dongjoon-hyun
left a comment
There was a problem hiding this comment.
For kll_sketch_get_quantile_bigint/_float/_double, kll_sketch_get_rank_*, the return type is sometimes array.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
cloud-fan
left a comment
There was a problem hiding this comment.
1 blocking, 0 non-blocking, 0 nits.
The documentation sweep is broadly consistent, but one family of timestamp constructors still has undocumented argument types.
Correctness (1)
- python/pyspark/sql/functions/builtin.py:26638: Document the remaining timezone/date/time argument types in the timestamp constructor family -- see inline
Verification
Compared the timestamp constructor docstrings with MakeTimestamp.inputTypes and MakeTimestampFromDateTime.inputTypes in Catalyst. These require string timezone, date, and time inputs for the parameters whose type phrases are still absent.
Uh oh!
There was an error while loading. Please reload this page.
…in the PySpark functions API ### What changes were proposed in this pull request? This documents, for every built-in function in the PySpark `functions` API (`builtin.py`), the accepted input type of each argument (`Parameters`) and the return type of each function (`Returns`), using the numeric umbrella where numeric subtypes cast in and `timestamp` for TIMESTAMP_NTZ in type phrases. Subtask of SPARK-57999, split out from apache#57079 for reviewability. This PR covers only the PySpark `builtin.py` surface. ### Why are the changes needed? The PySpark `functions` docstrings previously had no per-argument type information for most functions. This fills that gap. ### Does this PR introduce _any_ user-facing change? Yes, documentation only. No behavioral or API change. ### How was this patch tested? Python lint (flake8 + black) and the docstring doctests pass. Types were derived from and verified against the analyzer's behavior and each expression's `inputTypes` / `dataType`. Co-authored-by: Isaac
… to_char constant note, and broaden date extractor input types Co-authored-by: Isaac
…uctors Add the accepted-type phrases for the timezone (string), date, and time arguments across the make_timestamp / try_make_timestamp family, matching the Catalyst MakeTimestamp and MakeTimestampFromDateTime inputTypes contracts. Co-authored-by: Isaac
Match the SQL and Scala function reference by noting that the variadic concat_ws argument accepts a string or an array of strings. Co-authored-by: Isaac
423fd0b to
1c55308CompareAudit surfaced many functions where some arguments (or the return) carried an accepted-type phrase but sibling value arguments did not. Document the missing arguments and returns to match the per-argument coverage promised by the PR, keeping the accepted types consistent with the SQL and Scala function reference. Co-authored-by: Isaac
Add the accepted-type phrase to the Returns section of stddev and its std alias, matching the sibling aggregate functions. Co-authored-by: Isaac
Bring the from_json/to_json/schema_of_json, variant_*, from_csv/to_csv/ schema_of_csv, and from_xml/to_xml/schema_of_xml function families into the accepted-type documentation convention, documenting both their arguments and their return values to match the Scala functions API. Co-authored-by: Isaac
…n the PySpark functions API ### What changes were proposed in this pull request? This documents, for every built-in function in the PySpark `functions` API (`builtin.py`), the accepted input type of each argument (`Parameters`) and the return type of each function (`Returns`), using the numeric umbrella where numeric subtypes cast in and `timestamp` for TIMESTAMP_NTZ in type phrases. Subtask of SPARK-57999, split out from #57079 for reviewability. This PR covers only the PySpark `builtin.py` surface. ### Why are the changes needed? The PySpark `functions` docstrings previously had no per-argument type information for most functions. This fills that gap. ### Does this PR introduce _any_ user-facing change? Yes, documentation only. No behavioral or API change. ### How was this patch tested? Python lint (flake8 + black) and the docstring doctests pass. Types were derived from and verified against the analyzer's behavior and each expression's `inputTypes` / `dataType`. Co-authored-by: Isaac Closes#57185 from HyukjinKwon/split-func-types-python. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com> (cherry picked from commit ddd66fa) Signed-off-by: Hyukjin Kwon <hyukjin.kwon@databricks.com>
What changes were proposed in this pull request?
This documents, for every built-in function in the PySpark
functionsAPI (builtin.py), theaccepted input type of each argument (
Parameters) and the return type of each function(
Returns), using the numeric umbrella where numeric subtypes cast in andtimestampforTIMESTAMP_NTZ in type phrases.
Subtask of SPARK-57999, split out from #57079 for reviewability. This PR covers only
the PySpark
builtin.pysurface.Why are the changes needed?
The PySpark
functionsdocstrings previously had no per-argument type information for mostfunctions. This fills that gap.
Does this PR introduce any user-facing change?
Yes, documentation only. No behavioral or API change.
How was this patch tested?
Python lint (flake8 + black) and the docstring doctests pass. Types were derived from and verified
against the analyzer's behavior and each expression's
inputTypes/dataType.Co-authored-by: Isaac