Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-22980][PYTHON][SQL] Clarify the length of each series is of each batch within scalar Pandas UDF #20237

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions python/pyspark/sql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,11 @@ def pandas_udf(f=None, returnType=None, functionType=None):
| 8| JOHN DOE| 22|
+----------+--------------+------------+

.. note:: The length of `pandas.Series` within a scalar UDF is not of the whole input column
but of the batch internally used, and it is called for each batch. Therefore,
Copy link
Member

Choose a reason for hiding this comment

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

Does this sound a little better? "..scalar UDF is not that of the whole input column, but is the length of an internal batch used for each call to the function."

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, English isn't really my area :(. Will try to incorporate your suggestion.

this can be used, for example, to ensure the length of each returned `pandas.Series`
but should not be used as the length of the whole input.
Copy link
Member

Choose a reason for hiding this comment

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

How does this sound? "..pandas.Series, and can not be used as the column length"


2. GROUP_MAP

A group map UDF defines transformation: A `pandas.DataFrame` -> A `pandas.DataFrame`
Expand Down