[SPARK-56937][PYTHON] Raise error on wrong column count in Arrow grouped/cogrouped map UDF#55978
Open
Yicong-Huang wants to merge 1 commit into
Open
[SPARK-56937][PYTHON] Raise error on wrong column count in Arrow grouped/cogrouped map UDF#55978Yicong-Huang wants to merge 1 commit into
Yicong-Huang wants to merge 1 commit into
Conversation
Contributor
|
does these query also fail before this PR? |
Contributor
Author
No. They either silently drops data (too many) or surfaces a JVM ArrayIndexOutOfBoundsException (too few). |
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?
In
verify_arrow_result(python/pyspark/worker.py), the positional branch zips expected and actual columns without a length check, silently truncating to the shorter list. This PR raisesRESULT_COLUMN_SCHEMA_MISMATCHon length mismatch.Why are the changes needed?
Latent since SPARK-40559. Under
assignColumnsByName=false, a UDF returning the wrong number of columns either silently drops data (too many) or surfaces a JVMArrayIndexOutOfBoundsException(too few). The name-based branch already raises a friendly error; positional should be symmetric.Affects
SQL_GROUPED_MAP_ARROW_UDF,SQL_GROUPED_MAP_ARROW_ITER_UDF,SQL_COGROUPED_MAP_ARROW_UDF.Does this PR introduce any user-facing change?
Yes. Wrong column count under positional mode now raises
RESULT_COLUMN_SCHEMA_MISMATCHinstead of silent truncation or a JVM error.How was this patch tested?
Added
test_apply_in_arrow_returning_wrong_column_count_positional_assignmentintest_arrow_grouped_map.py(covers iterator variant viafunction_variations) andtest_arrow_cogrouped_map.py, exercising both too-many and too-few columns. Full grouped/cogrouped Arrow map suites pass.Was this patch authored or co-authored using generative AI tooling?
No.