Skip to content

[SPARK-58087][PYTHON][DOCS] Document accepted input and return types in the PySpark functions API#57185

Open
HyukjinKwon wants to merge 2 commits into
apache:masterfrom
HyukjinKwon:split-func-types-python
Open

[SPARK-58087][PYTHON][DOCS] Document accepted input and return types in the PySpark functions API#57185
HyukjinKwon wants to merge 2 commits into
apache:masterfrom
HyukjinKwon:split-func-types-python

Conversation

@HyukjinKwon

Copy link
Copy Markdown
Member

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

Comment thread python/pyspark/sql/functions/builtin.py Outdated
Comment thread python/pyspark/sql/functions/builtin.py Outdated
Comment thread python/pyspark/sql/functions/builtin.py Outdated
Comment thread python/pyspark/sql/functions/builtin.py Outdated
Comment thread python/pyspark/sql/functions/builtin.py Outdated
@HyukjinKwon

Copy link
Copy Markdown
Member Author

Thank you @dongjoon-hyun for review. Let me try to take a look throughoutly.

@HyukjinKwon
HyukjinKwon marked this pull request as draft July 12, 2026 22:08
@HyukjinKwon
HyukjinKwon force-pushed the split-func-types-python branch from 7cda100 to 241f910 Compare July 12, 2026 22:18
…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
@HyukjinKwon
HyukjinKwon force-pushed the split-func-types-python branch from 241f910 to d9b102b Compare July 13, 2026 00:01
@HyukjinKwon
HyukjinKwon marked this pull request as ready for review July 13, 2026 06:26
Comment thread python/pyspark/sql/functions/builtin.py Outdated

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For kll_sketch_get_quantile_bigint/_float/_double, kll_sketch_get_rank_*, the return type is sometimes array.

Comment thread python/pyspark/sql/functions/builtin.py
Comment thread python/pyspark/sql/functions/builtin.py Outdated
… to_char constant note, and broaden date extractor input types

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants