Skip to content

[MINOR][PYTHON][TESTS] Add TaskContext tests for scalar Arrow UDFs - #57744

Closed
zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:task-context-arrow-udf-dev1
Closed

[MINOR][PYTHON][TESTS] Add TaskContext tests for scalar Arrow UDFs#57744
zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:task-context-arrow-udf-dev1

Conversation

@zhengruifeng

Copy link
Copy Markdown
Contributor

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)

@zhengruifeng zhengruifeng changed the title [MINOR][PYTHON] Add TaskContext tests for scalar Arrow UDFs [MINOR][PYTHON][TESTS] Add TaskContext tests for scalar Arrow UDFs 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>
@zhengruifeng

Copy link
Copy Markdown
Contributor Author

Merge Summary:

Posted by merge_spark_pr.py

@zhengruifeng
zhengruifeng deleted the task-context-arrow-udf-dev1 branch August 4, 2026 09:32
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