[SPARK-58577][PYTHON] Inline wrap_udf into the batched UDF dispatch branch in worker.py - #57775
Closed
Yicong-Huang wants to merge 1 commit into
Closed
[SPARK-58577][PYTHON] Inline wrap_udf into the batched UDF dispatch branch in worker.py#57775Yicong-Huang wants to merge 1 commit into
Yicong-Huang wants to merge 1 commit into
Conversation
HyukjinKwon
approved these changes
Aug 4, 2026
…ranch in worker.py
Yicong-Huang
force-pushed
the
inline-wrap-udf
branch
from
August 5, 2026 01:18
8f19e2b to
3313c09
Compare
Yicong-Huang
added a commit
that referenced
this pull request
Aug 5, 2026
…ranch in worker.py ### What changes were proposed in this pull request? Inline the single-caller `wrap_udf` helper into the `SQL_BATCHED_UDF` branch of `read_single_udf` in `worker.py` and delete its definition. The two steps it did (`wrap_kwargs_support`, then a `needConversion()`/`toInternal` wrap) are already open-coded inline in the neighboring dispatch branches, so this just makes the outlier match the prevailing idiom. A short comment preserves the semantic label. ### Why are the changes needed? `wrap_udf` is a thin single-caller wrapper that diverges from the inline-in-branch pattern of `read_single_udf`. Removing the indirection makes the branch self-contained and consistent with its neighbors. ### Does this PR introduce _any_ user-facing change? No. Pure internal refactor; the closure capture and the `needConversion()` split are unchanged. ### How was this patch tested? Existing `pyspark.sql.tests.test_udf UDFTests` passes. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #57775 from Yicong-Huang/inline-wrap-udf. Authored-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> Signed-off-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> (cherry picked from commit 94ecd04) Signed-off-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com>
Yicong-Huang
added a commit
that referenced
this pull request
Aug 5, 2026
…ranch in worker.py ### What changes were proposed in this pull request? Inline the single-caller `wrap_udf` helper into the `SQL_BATCHED_UDF` branch of `read_single_udf` in `worker.py` and delete its definition. The two steps it did (`wrap_kwargs_support`, then a `needConversion()`/`toInternal` wrap) are already open-coded inline in the neighboring dispatch branches, so this just makes the outlier match the prevailing idiom. A short comment preserves the semantic label. ### Why are the changes needed? `wrap_udf` is a thin single-caller wrapper that diverges from the inline-in-branch pattern of `read_single_udf`. Removing the indirection makes the branch self-contained and consistent with its neighbors. ### Does this PR introduce _any_ user-facing change? No. Pure internal refactor; the closure capture and the `needConversion()` split are unchanged. ### How was this patch tested? Existing `pyspark.sql.tests.test_udf UDFTests` passes. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #57775 from Yicong-Huang/inline-wrap-udf. Authored-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> Signed-off-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com> (cherry picked from commit 94ecd04) Signed-off-by: Yicong Huang <17627829+Yicong-Huang@users.noreply.github.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Inline the single-caller
wrap_udfhelper into theSQL_BATCHED_UDFbranch ofread_single_udfinworker.pyand delete its definition. The two steps it did (wrap_kwargs_support, then aneedConversion()/toInternalwrap) are already open-coded inline in the neighboring dispatch branches, so this just makes the outlier match the prevailing idiom. A short comment preserves the semantic label.Why are the changes needed?
wrap_udfis a thin single-caller wrapper that diverges from the inline-in-branch pattern ofread_single_udf. Removing the indirection makes the branch self-contained and consistent with its neighbors.Does this PR introduce any user-facing change?
No. Pure internal refactor; the closure capture and the
needConversion()split are unchanged.How was this patch tested?
Existing
pyspark.sql.tests.test_udf UDFTestspasses.Was this patch authored or co-authored using generative AI tooling?
No.