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

   ### What changes were proposed in this pull request?
   
   Two changes, the second of which found the first:
   
   1. **Loaded params are sent again as PySpark sends them.**
      - PySpark's load turns each param that the server reads into a Python 
value (`deserialize_param`). Its next save, fit or transform serializes that 
value with the inference of `serialize_param`, which has one int and one float 
type. So a `seed` that the server reads back as a `Long` is sent again as an 
`Integer`.
      - The Rust client kept the literals of the `Read` as they were. The save 
of every loaded estimator and model that has a `seed` sent it as a `Long`.
      - `read` of `spark_connect::ml` (`object.rs`) now types the params of a 
`Read` as PySpark sends them again: an integral literal is an `Integer` when it 
fits in 32 bits, else a `Long`, and a `Float` is a `Double`. Other literals 
stay as they are.
      - `read_operator`, `read_model` and every typed `load` go through it. The 
getters read an `Integer` and a `Long` alike.
   2. **Offline replays of the regression and clustering goldens.** 
`tests/golden/{regression,clustering}_{models,summaries,persistence}.json` 
(#676) had no test that read them. `regression_api_replay.rs` and 
`clustering_api_replay.rs` replay them with the replay server of 
`tests/common/ml_golden.rs`, and need no Spark server. They cover:
      - the fits of every family;
      - the value members of the models, of the trees of the ensembles and of 
the local LDA model;
      - the training and evaluate summaries;
      - the save and load of every estimator and model, whose loaded params are 
compared with those that the golden save sends.
   
      Each entry sends the golden commands, and returns the golden value or an 
error carrying its message. Skipped:
      - the DataFrame-valued members, whose rows the replay does not serve;
      - the Python-only `repr` and `str`;
      - the class attributes;
      - the `trees` member, which PySpark reads from the fetch of its fit or 
load. The test calls `trees()` right after them, so that fetch is compared.
   
      Each file has a negative test, of a request that differs from its golden.
   
   ### Why are the changes needed?
   
   Parity with PySpark 4.3.0: a loaded model saved again by the Rust client 
should send what PySpark sends. The replays also check the regression and 
clustering families of the Rust ML API against the official goldens in every CI 
run, which until now only the live tests did, and those compare values.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, in the unreleased typed ML API. A loaded object sends its integral 
params as PySpark does: an `Integer` when the value fits in 32 bits. Before, it 
sent the `Long` of the server's read.
   
   ### How was this patch tested?
   
   - A new unit test of `read`'s typing of params, built from a proto 
`MlOperatorInfo`.
   - `cargo test -p apache-spark-connect`: every offline test passed, including 
the replays (16 and 13).
   - The live e2e tests that load and save passed against a Spark 4.3.0 server: 
`e2e_ml_regression_api`, `e2e_ml_clustering_api`, `e2e_lr_svc_api`, 
`e2e_ml_object`, `e2e_feature_models` and `e2e_fpm_recommendation_evaluation`.
   - The coverage job's offline Python list passed 4684, with 13 skipped, on a 
drop-in built of this branch.
   - Clippy (`-D warnings`) and fmt are clean.
   
   ### 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