HyukjinKwon opened a new pull request, #352: URL: https://github.com/apache/spark-connect-rust/pull/352
### What changes were proposed in this pull request? [SPARK-61163](https://issues.apache.org/jira/browse/SPARK-61163): PySpark Connect's `GroupedData.apply` takes only a `pandas_udf` of `SQL_GROUPED_MAP_PANDAS_UDF`: - anything else raises `PySparkTypeError` `INVALID_UDF_EVAL_TYPE`, of `eval_type` `SQL_GROUPED_MAP_PANDAS_UDF`: a function, a UDF of another eval type, or a Column, which it checks first, as a Column has any attribute - such a UDF is applied with `applyInPandas`, of its function and return type, with PySpark's `UserWarning` to prefer `applyInPandas` The client's `apply` now checks and warns the same way. The warning is PySpark's text. Its line is broken after "in the" because the no-stub audit matches "in the future" on one line, as `catalog.rs` and `column.rs` break theirs. ### Why are the changes needed? The client checked only for a `func` attribute: - for a function, it raised a plain `TypeError` ("apply() expects a pandas_udf of type SQL_GROUPED_MAP_PANDAS_UDF") - a UDF of another eval type, or a Column (whose `func` is a field), went on to `applyInPandas` - it did not warn Apache Spark's `test_wrong_args` of `test_parity_pandas_grouped_map.py` failed on this client. ### Does this PR introduce _any_ user-facing change? Yes. `GroupedData.apply` raises the errors and the warning of PySpark 4.3.0. ### How was this patch tested? - A new offline test, against a mock Connect server, checks the error class and parameters for a function, a UDF, two Columns and two scalar pandas UDFs. It also checks that a grouped-map pandas UDF warns and is sent with its eval type. It fails without this change. - The rows, warnings and error of `apply` against a local server are those of official PySpark 4.3.0. - Apache Spark's `test_parity_pandas_grouped_map.py` passes on this client against a local server: 47 tests pass and 3 are skipped, including `test_wrong_args`. - The lib tests of both crates (597 passed), the build of all tests, also with `wasm-udf`, the offline Python suites (2219 passed, 8 skipped), and the live drop-in and Arrow suites (201 passed) and live cases (10 passed) against a local Spark 4.3.0 server. Clippy reports no diagnostics in the changed lines. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Opus 5.5 This pull request and its description were written by Isaac. -- 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]
