HyukjinKwon opened a new pull request, #703:
URL: https://github.com/apache/spark-connect-rust/pull/703
### What changes were proposed in this pull request?
The offline replay of the ML goldens
(`crates/spark-connect/tests/common/ml_golden.rs`, from #682) has three gaps,
found while writing replays of the feature goldens:
- **NaN params never matched.** The replay compared decoded `MlCommand`s
with `==`, and NaN is not equal to itself. So a command with a NaN param, such
as Imputer's fit with `missingValue` NaN and its saves, never matched its
golden. `normalize_commands` now replaces each NaN double or float literal with
one marker on both sides. It reaches params, fetch arguments, and nested array,
map and struct literals. Encoded bytes are not compared, because the proto maps
do not encode in a fixed order.
- **A uid inside a string value was not normalized.**
`CountVectorizerModel.from_vocabulary` and `StringIndexerModel.from_labels`
send the new model's uid as a string argument of a helper fetch, and the golden
has `<uid0>` there. String values now get the substitution that
`scripts/ml_golden_common.py` applies: `[A-Za-z]+_[0-9a-f]{12}` becomes
`<uidN>`, numbered with the same per-entry counter as the uid fields, in the
same order.
- **DataFrame member entries failed to decode.** Their command is an
`MlRelation`, but `register` decoded every command as an `MlCommand`.
`register` now skips them, since relation entries are not replayed.
`golden_commands` and `assert_commands` fail on one with a clear message
instead of a decode panic.
### Why are the changes needed?
So the feature goldens, and any area's goldens with NaN params, helper
constructors or DataFrame members, can be replayed offline in CI like the
classification ones.
### Does this PR introduce _any_ user-facing change?
No, test helpers only.
### How was this patch tested?
- `ml_golden_replay.rs` gets one test per gap, using real entries of
`tests/golden/feature_models.json`:
- the Imputer fit with a NaN param;
- the `from_vocabulary` and `from_labels` helper fetches;
- a QuantileDiscretizer DataFrame member, replayed beside the LinearSVC
coefficients.
- Each test fails without the fix, each with its own error, and passes with
it.
- The other tests that use `ml_golden.rs` pass, and so do the crate's lib
tests.
- `cargo fmt --check` and `cargo +1.100.0 clippy --workspace --all-targets
-- -D warnings` 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]