Skip to content

[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
apache:masterfrom
Yicong-Huang:inline-wrap-udf
Closed

[SPARK-58577][PYTHON] Inline wrap_udf into the batched UDF dispatch branch in worker.py#57775
Yicong-Huang wants to merge 1 commit into
apache:masterfrom
Yicong-Huang:inline-wrap-udf

Conversation

@Yicong-Huang

@Yicong-Huang Yicong-Huang commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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.

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>
@Yicong-Huang

Copy link
Copy Markdown
Contributor Author

Merge Summary:

Posted by merge_spark_pr.py

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