[MINOR][PYTHON][TESTS] Add TaskContext tests for scalar Arrow UDFs - #57744
Closed
zhengruifeng wants to merge 1 commit into
Closed
[MINOR][PYTHON][TESTS] Add TaskContext tests for scalar Arrow UDFs#57744zhengruifeng wants to merge 1 commit into
zhengruifeng wants to merge 1 commit into
Conversation
HyukjinKwon
approved these changes
Aug 4, 2026
zhengruifeng
added a commit
that referenced
this pull request
Aug 4, 2026
### What changes were proposed in this pull request?
Add a test to ScalarArrowUDFTestsMixin that verifies TaskContext is initialized in both scalar and scalar-iterator Arrow UDFs. The test checks the partition IDs returned by TaskContext and is also inherited by the Spark Connect parity suite.
### Why are the changes needed?
TaskContext is covered for Pandas UDFs and mapInArrow, but scalar Arrow UDFs did not have equivalent coverage. This test closes that gap and guards classic and Spark Connect execution against regressions.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
build/sbt -Phive package
conda run -n spark-dev-313 --no-capture-output python/run-tests --testnames "pyspark.sql.tests.arrow.test_arrow_udf_scalar ScalarArrowUDFTests.test_arrow_udf_task_context"
conda run -n spark-dev-313 --no-capture-output python/run-tests --testnames "pyspark.sql.tests.connect.arrow.test_parity_arrow_udf_scalar ScalarArrowPythonUDFParityTests.test_arrow_udf_task_context"
conda run -n spark-dev-313 ruff check python/pyspark/sql/tests/arrow/test_arrow_udf_scalar.py
conda run -n spark-dev-313 ruff format --check python/pyspark/sql/tests/arrow/test_arrow_udf_scalar.py
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-5)
Closes #57744 from zhengruifeng/task-context-arrow-udf-dev1.
Authored-by: Ruifeng Zheng <ruifengz@apache.org>
Signed-off-by: Ruifeng Zheng <ruifengz@foxmail.com>
(cherry picked from commit 5cb1801)
Signed-off-by: Ruifeng Zheng <ruifengz@foxmail.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?
Add a test to ScalarArrowUDFTestsMixin that verifies TaskContext is initialized in both scalar and scalar-iterator Arrow UDFs. The test checks the partition IDs returned by TaskContext and is also inherited by the Spark Connect parity suite.
Why are the changes needed?
TaskContext is covered for Pandas UDFs and mapInArrow, but scalar Arrow UDFs did not have equivalent coverage. This test closes that gap and guards classic and Spark Connect execution against regressions.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-5)