HyukjinKwon opened a new pull request, #361: URL: https://github.com/apache/spark-connect-rust/pull/361
### What changes were proposed in this pull request? [SPARK-61172](https://issues.apache.org/jira/browse/SPARK-61172): PySpark Connect's `DataFrameReader`, `DataFrameWriter`, `DataFrameWriterV2` and `DataStreamReader` have `_set_opts` of `OptionUtils`. It sets the schema, if any, and the options that are not None. pandas-on-Spark's `to_csv` and `to_json` with a path call it on the writer of the DataFrame. The readers and writers of the client now have `_set_opts`, as PySpark's. It sets them through the object's own `schema` and `option`, which convert them and raise their errors: - a schema that is not None goes to `schema`; a writer has none, so it raises `AttributeError`, as PySpark's - each option that is not None goes to `option`, so a bool is `"true"`/`"false"` and an option of None is left unset ### Why are the changes needed? They had no `_set_opts`: ``` AttributeError: 'pyspark.sql.connect.readwriter.DataFrameWriter' object has no attribute '_set_opts' ``` ### Does this PR introduce _any_ user-facing change? Yes. The readers and writers have `_set_opts` of PySpark 4.3.0, and pandas-on-Spark's `to_csv` and `to_json` with a path write their files. ### How was this patch tested? - A new e2e test writes a CSV with the options of `_set_opts` of the writer, among them one of None, and reads it back with the schema and options of `_set_opts` of the reader. It also checks the `AttributeError` of a schema on a writer, and that `_set_opts` is on `DataStreamReader` and `DataFrameWriterV2`. It fails without this change, and its body passes with official PySpark 4.3.0. - pandas-on-Spark's `to_csv` and `to_json` with a path, against a local server, write the files that official PySpark 4.3.0 writes. - The lib tests of both crates (597 passed), the build of all tests, also with `wasm-udf`, the offline Python suites (2222 passed, 8 skipped), and the live drop-in and Arrow suites (207 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]
