HyukjinKwon opened a new pull request, #668:
URL: https://github.com/apache/spark-connect-rust/pull/668

   ### What changes were proposed in this pull request?
   
   The native ML areas (classification, regression, clustering, feature, fpm, 
recommendation...) each capture a golden of their models and summaries from 
official PySpark 4.3.0: the value of each member, and the ML command PySpark 
sends for it. This PR adds the helper they share, 
`scripts/ml_golden_common.py`, so that every area records and normalizes its 
golden the same way. The area scripts 
(`scripts/capture_<area>_models_golden.py`) and their `tests/golden/*.json` 
come with each area's PRs.
   
   The helper:
   - **Runs an area's tables on the official client:** the attributes and 
labelled calls of each model and summary class, class methods, datasets (built 
from a column spec, or registered from SQL), estimator fits, and save/load 
round trips.
   - **Records each call's requests and responses:** the `MlCommand` or 
`MlRelation` it sends and the `MlCommandResult` it gets back, as base64 of the 
deterministic serialization. Object ids, summary ids and uids are numbered per 
entry in order of first appearance (`<id0>`, `<uid0>`), so an entry can be 
replayed alone. Plan ids, origins and local relation data are cleared, and 
paths are normalized.
   - **Renders values as JSON:**
     - vectors and matrices, including `pyspark.mllib`'s;
     - DataFrames, as their schema and sorted rows;
     - model refs;
     - errors, as their class, condition and message, including the lazy error 
of a DataFrame result;
     - non-finite floats, as strings.
   - **Checks coverage and determinism:** every public member of a model or 
summary must be covered by a table entry or skipped with a reason. Garbage 
collection is kept out of the recorded calls, so a finalizer's `Delete` never 
lands in an entry and the goldens are byte-identical across runs.
   
   ### Why are the changes needed?
   
   The native ML layer is being completed to the full `pyspark.ml` 4.3.0 
surface: typed models, summaries, single-vector predict and persistence, in the 
Rust API and the Python client. Each area proves parity with golden tests that 
replay PySpark's requests and compare the values. A shared helper keeps the 
fixtures of all areas in one format, which one test harness can read.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No, a test-support script only.
   
   ### How was this patch tested?
   
   - The classification area's golden (classification models, summaries and 
persistence, about 890 entries) was captured with it twice: the two runs are 
byte-identical.
   - The regression, clustering and feature areas captured theirs with it too.
   - The ruff gates pass.
   
   ### 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]

Reply via email to