HyukjinKwon opened a new pull request, #626: URL: https://github.com/apache/spark-connect-rust/pull/626
### What changes were proposed in this pull request? A follow-up of #607 (SPARK-61611), from the r9 post-merge review: - **The error order of the native LogisticRegression.** PySpark's `_fit` reads `count`, `first(array_size(features))` and `collect_set(label)` in one aggregate. So for features that are neither an array nor an ML vector (a string, a number, a struct, a map, ...), the server raises `AnalysisException [DATATYPE_MISMATCH.UNEXPECTED_INPUT_TYPE]` before any label check. The native fit ran only `collect_set(label)`, so it raised the label `ValueError` or a JVM error instead. For such features it now puts `first(array_size(features))` before `collect_set(label)` in its aggregate. The schema is already cached, so this sends no extra request. Arrays and vectors send the query as before. - **The official `test_connect_feature.py`** is no longer skipped (`scripts/dropin_known_failures.txt`). The scalers are PySpark's own since #607, and it passes on the drop-in (5/5). - **Stale text**: the docs, the 4.3.0 module audit, a test comment, a doc comment in `ml.rs`, and the package docstring of `pyspark.ml.connect` no longer describe the scalers as native. They also say that PySpark's `pyspark.ml.connect` classes take no vectors, so vector features are this client's extension. - **The Rust `StandardScaler`**: its doc gives Spark's defaults (`withStd` true, `withMean` false). It gets `set_with_std` and `with_std`, as `set_with_mean` and `with_mean`. ### Why are the changes needed? To match PySpark 4.3.0, and to describe the scalers as they are. ### Does this PR introduce _any_ user-facing change? Yes: - In the Python client, the fit of a LogisticRegression on such features raises PySpark's `DATATYPE_MISMATCH`. - In the Rust API, `StandardScaler::set_with_std` and `with_std` are added. ### How was this patch tested? - A new e2e test of the features' types: string, double, struct, a renamed `featuresCol`, `array<string>`, `void` and vectors. It fails without the change. A new Rust unit test. - A probe of 22 cases against a replay of PySpark's `_fit` query (torch is unavailable here) gives the same errors, conditions and messages. - `test_ml_offline.py` (151 passed), `test_ml_e2e.py` (30 passed), the other ML e2e files, and the lib tests (680 passed). - The official `test_connect_feature.py` through the drop-in runner (5/5), `cargo fmt --all --check` and ruff 0.14.0. ### 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]
