Skip to content

[SPARK-58768][PYTHON][TESTS] Fix monkey-patch in test_parity_udf and test_parity_udtf - #58001

Closed
gaogaotiantian wants to merge 1 commit into
apache:masterfrom
gaogaotiantian:fix-monkey-patch
Closed

[SPARK-58768][PYTHON][TESTS] Fix monkey-patch in test_parity_udf and test_parity_udtf#58001
gaogaotiantian wants to merge 1 commit into
apache:masterfrom
gaogaotiantian:fix-monkey-patch

Conversation

@gaogaotiantian

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  • For test_parity_udtf:
    • Removed the unnecessary monkeypatch for sql.udtf.UserDefinedTableFunction
    • Use the general version builtin function because it should be automatically redirected
  • For test_parity_udf:
    • Move the monkey patch to setUpClass
    • Patch the test module, instead of pyspark.sql

Why are the changes needed?

The original monkey-patch has a large blast radius and is sensitive to import order. We should minimum monkey patch impact.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

CI.

Was this patch authored or co-authored using generative AI tooling?

No.

@uros-b

uros-b commented Aug 14, 2026

Copy link
Copy Markdown
Member

Thank you @gaogaotiantian!

gaogaotiantian added a commit that referenced this pull request Aug 15, 2026
…est_parity_udtf

### What changes were proposed in this pull request?

* For `test_parity_udtf`:
    * Removed the unnecessary monkeypatch for `sql.udtf.UserDefinedTableFunction`
    * Use the general version builtin function because it should be automatically redirected
* For `test_parity_udf`:
    * Move the monkey patch to `setUpClass`
    * Patch the test module, instead of `pyspark.sql`

### Why are the changes needed?

The original monkey-patch has a large blast radius and is sensitive to import order. We should minimum monkey patch impact.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

CI.

### Was this patch authored or co-authored using generative AI tooling?

No.

Closes #58001 from gaogaotiantian/fix-monkey-patch.

Authored-by: Tian Gao <gaogaotiantian@hotmail.com>
Signed-off-by: Tian Gao <gaogaotiantian@hotmail.com>
(cherry picked from commit 76735aa)
Signed-off-by: Tian Gao <gaogaotiantian@hotmail.com>
@gaogaotiantian

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