Yicong-Huang opened a new pull request, #54212: URL: https://github.com/apache/spark/pull/54212
### What changes were proposed in this pull request? Remove the redundant `or runner_conf.use_legacy_pandas_udf_conversion` condition from `struct_in_pandas` and `ndarray_as_list` in the `else` branch of serializer selection in `read_udfs`. ### Why are the changes needed? In the serializer selection logic in `read_udfs`, `SQL_ARROW_BATCHED_UDF` with `use_legacy_pandas_udf_conversion=False` is handled by an earlier `elif` branch (using `ArrowBatchUDFSerializer`). It only falls through to the `else` branch when `use_legacy_pandas_udf_conversion=True`, in which case `eval_type == SQL_ARROW_BATCHED_UDF` is already `True`. Therefore, the `or runner_conf.use_legacy_pandas_udf_conversion` is redundant for the intended case (`SQL_ARROW_BATCHED_UDF` with legacy enabled). Worse, it introduces an unintended side effect: when `use_legacy_pandas_udf_conversion=True` and `eval_type` is a different type (e.g., `SQL_SCALAR_PANDAS_UDF`), it incorrectly changes `struct_in_pandas` from `"dict"` to `"row"` and `ndarray_as_list` from `False` to `True`. ### Does this PR introduce _any_ user-facing change? No. The config `use_legacy_pandas_udf_conversion` is only intended for `SQL_ARROW_BATCHED_UDF` and its default is `false`. This fix prevents unintended behavior for other eval types when the config is explicitly enabled. ### How was this patch tested? Existing UDF tests. ### Was this patch authored or co-authored using generative AI tooling? No. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
