[SPARK-56327][PYTHON][TESTS] Fix grouped map pandas tests for pandas 3#55146
Closed
ueshin wants to merge 2 commits intoapache:masterfrom
Closed
[SPARK-56327][PYTHON][TESTS] Fix grouped map pandas tests for pandas 3#55146ueshin wants to merge 2 commits intoapache:masterfrom
ueshin wants to merge 2 commits intoapache:masterfrom
Conversation
Member
Author
zhengruifeng
approved these changes
Apr 2, 2026
Member
Author
|
Thanks! merging to master. |
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?
This PR updates
python/pyspark/sql/tests/pandas/test_pandas_grouped_map.pyfor pandas 3 behavior in grouped map pandas UDF tests.The changes are:
test_supported_typesto use~pdf.boolon pandas 3 while keeping the existing behavior on older pandas versionspdf.id.copy()so the grouped pandas input still keeps the grouping columns while preserving the original grouping semanticsWhy are the changes needed?
In pandas 3,
GroupBy.applydrops grouping columns when the grouping key is the same DataFrame column. These tests build expected results by applying the Python function to pandas-grouped data, so the previous expectations no longer match the grouped map input shape seen by Spark in cases that rely on grouping columns remaining present.The boolean expectation also needs a pandas-3-specific branch because the old scalar-style inversion logic does not match the pandas 3 object being operated on in these tests.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Updated the related tests.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-5)