HyukjinKwon opened a new pull request, #702:
URL: https://github.com/apache/spark-connect-rust/pull/702
### What changes were proposed in this pull request?
This PR adds two offline replay tests of the official PySpark 4.3.0 goldens
of the feature, fpm, recommendation and evaluation families, with the replay
server of `tests/common/ml_golden.rs` (#682). No Spark server is needed:
- `crates/spark-connect/tests/feature_models_replay.rs` replays
`tests/golden/feature_models.json` and `feature_models_persistence.json`:
- the fits of 25 of the 26 cases;
- the value members of their models;
- the class methods that build a model client-side;
- the save and load of 72 of the 74 transformer, estimator and model
records.
- `crates/spark-connect/tests/fpm_recommendation_evaluation_replay.rs`
replays `tests/golden/fpm_recommendation_evaluation.json` and
`fpm_recommendation_evaluation_persistence.json`:
- the FPGrowth and ALS fits;
- the `evaluate` and `isLargerBetter` of the six evaluators and of their
loaded copies;
- their save and load.
Each replayed entry sends the golden commands, and returns the golden value
or an error carrying the golden message. Each file has a negative test: a
request that differs from its golden fails the check. The tests also check that
every golden record is either replayed or in a left-out list with its reason.
Left out, each with a comment naming its finding:
- **Mismatches in the Rust client**:
- `StopWordsRemover.load` does not fetch the default stop words, as
PySpark's load does.
- `ALSModel.rank` is the value cached at the fit, where PySpark fetches it.
- `ALSModel.load` fetches the rank once more than PySpark does.
- **Gaps of the replay**:
- A command with a NaN param never compares equal (Imputer).
- A random uid in a string argument is not normalized
(`CountVectorizerModel.from_vocabulary` and `StringIndexerModel.from_labels`).
- **Members the replay cannot serve**: the DataFrame-valued members, whose
rows are Arrow data, and the Python-only `repr` and `str`.
### Why are the changes needed?
The live tests of these families compare values only. These replays also
check, in every CI run and without a server, that the Rust ML API sends exactly
what PySpark sends. Writing them turned up the three mismatches above.
### Does this PR introduce _any_ user-facing change?
No, test-only.
### How was this patch tested?
`cargo test -p apache-spark-connect --test feature_models_replay --test
fpm_recommendation_evaluation_replay`: 4 and 4 passed. Clippy (`-D warnings`)
and fmt are clean. The `cargo test` of `rust.yml` runs both files, since it has
no `--test` filter.
### 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]