[SPARK-54531][PYTHON] Introduce ArrowStreamAggPandasUDFSerializer #53239
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 separates
SQL_GROUPED_AGG_PANDAS_UDFandSQL_WINDOW_AGG_PANDAS_UDFinto a dedicated serializerArrowStreamAggPandasUDFSerializer, aligning with the existingArrowStreamAggArrowUDFSerializerarchitecture.Why are the changes needed?
Input/Output type differences: Aggregation UDFs (
SQL_GROUPED_AGG_PANDAS_UDFandSQL_WINDOW_AGG_PANDAS_UDF) have different input/output types compared to grouped map UDFs:pd.Series(entire group/partition), output is scalar(keys, vals)wherevalsispd.DataFrame, output ispd.DataFrameMulti-UDF support: Aggregation UDFs support multiple UDFs in a single projection/aggregation, while grouped map UDFs do not.
Does this PR introduce any user-facing change?
No. This is an internal refactoring that does not change the public API or behavior. The serialization logic remains functionally equivalent.
How was this patch tested?
All existing tests continue to pass, and a new multi-UDF test (
test_pandas_udf_window.py::WindowPandasUDFTests::test_multiple_udfs) was added.Was this patch authored or co-authored using generative AI tooling?
No