HyukjinKwon opened a new pull request, #599: URL: https://github.com/apache/spark-connect-rust/pull/599
### What changes were proposed in this pull request? Three follow-ups to #583, so that the native `pyspark.ml.connect` scalers and LogisticRegression behave as PySpark's do: - **A scaler whose `outputCol` is its `inputCol` fits.** Spark's fit checks that the output column is absent, so the fit now sends no `outputCol`, and the model keeps it. Its transform then raises PySpark's `ValueError` for an existing output column, at the transform as PySpark does. Before, the fit raised `IllegalArgumentException: Output column x already exists`. - **A NaN in a pandas input stays NaN.** A pandas DataFrame is now sent as an Arrow table built without pandas' NaN-to-null conversion. Before, a NaN element of an array became a null, and the scaler failed with `NOT_NULL_ASSERT_VIOLATION`. - **An empty pandas DataFrame transforms.** It is now computed without the server, which cannot infer its schema. A scaler appends an empty `object` column, as PySpark does. LogisticRegression raises PySpark's own `ValueError: need at least one array to stack`. Before, both raised `CANNOT_INFER_EMPTY_SCHEMA`. ### Why are the changes needed? A review of #583 against the official `pyspark-client` 4.3.0 found these three differences. ### Does this PR introduce _any_ user-facing change? Yes, the three behaviors above now match PySpark 4.3.0. One difference remains, and `docs/compatibility.md` documents it: a pandas fit of `MaxAbsScaler` uses Spark's statistics, whose maximum skips a NaN element, where PySpark's local fit makes the scale of that feature NaN. ### How was this patch tested? - New offline tests in `test_ml_offline.py` and live tests in `test_ml_e2e.py`, for all three cases. - `test_ml_offline.py`: 133 passed. - `test_ml_e2e.py` and `test_gaussian_mixture_e2e.py` against a Spark 4.3.0 Connect server: 42 passed. - `test_dropin_offline.py`: 1957 passed, 8 skipped. - `cargo fmt --all --check` passes, and the drop-in builds without warnings. - The three scenarios give the same results and errors as the official `pyspark-client` 4.3.0, for both scalers. ### 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]
