HyukjinKwon opened a new pull request, #355: URL: https://github.com/apache/spark-connect-rust/pull/355
### What changes were proposed in this pull request? [SPARK-61164](https://issues.apache.org/jira/browse/SPARK-61164): PySpark's `AnalyzeArgument`, `PartitioningColumn`, `OrderingColumn` and `SelectedColumn`, of the `analyze` method of a polymorphic UDTF, are frozen dataclasses of `pyspark.sql.udtf`. The client's are now PySpark 4.3.0's, verbatim, with their docstrings, as `AnalyzeResult` already is (SPARK-61089). So: - a UDTF handler that captures them pickles with them, by reference - the Python worker of the server, which runs `analyze`, unpickles them as PySpark's - they have the fields, defaults, equality, hashing, `repr` and `FrozenInstanceError` of dataclasses The classes of the Rust extension that these were, and the Rust `AnalyzeResult` that SPARK-61089 left, are removed: nothing used them any more. `SkipRestOfInputTableException` stays the exception of the extension. ### Why are the changes needed? The classes of the extension could not be pickled. A handler whose `analyze` returns an `AnalyzeResult` defined outside of it failed to serialize: ``` PySparkPicklingError: [UDTF_SERIALIZATION_ERROR] Cannot serialize the UDTF 'TestUDTF' ... TypeError: cannot pickle 'pyspark.sql.udtf.PartitioningColumn' object ``` Apache Spark's `test_udtf_with_scalar_analyze_returning_wrong_result` and `test_udtf_with_table_analyze_returning_wrong_result` of `test_parity_udtf.py` failed on this client, in two variants each. ### Does this PR introduce _any_ user-facing change? Yes. The four classes are PySpark 4.3.0's frozen dataclasses, and handlers that capture them can be sent. ### How was this patch tested? - A new offline test checks: - that the four classes are frozen dataclasses of `pyspark.sql.udtf`, of PySpark's fields and defaults - their equality, hashing, `repr` and `FrozenInstanceError` - the pickling of a function that captures an `AnalyzeResult` of them It passes with official PySpark 4.3.0, and fails without this change. - A new live test runs a UDTF whose `analyze` returns a captured `AnalyzeResult` of a `PartitioningColumn`, and gets the `AnalysisException` of `partitionBy` from the worker, as Apache Spark's test does. It passes with official PySpark 4.3.0, and fails without this change. - Apache Spark's `test_parity_udtf.py` and `arrow/test_parity_arrow_udtf.py` pass on this client against a local server: 256 and 47 tests pass. Before this change, 4 tests of `test_parity_udtf.py` failed. - 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 (202 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]
