HyukjinKwon opened a new pull request, #669:
URL: https://github.com/apache/spark-connect-rust/pull/669
### What changes were proposed in this pull request?
This PR adds `scripts/capture_ml_api_golden.py` and its output,
`tests/golden/ml_api.json`. The file records the API of official
`pyspark-client` 4.3.0's `pyspark.ml`: the 142 public classes of
`classification`, `regression`, `clustering`, `feature`, `fpm`,
`recommendation`, `evaluation`, `stat`, `tuning` and
`Pipeline`/`PipelineModel`. For each class it records:
- **`params`**: each `Param` in PySpark's `params` order (by name), with its
doc, the name of its `TypeConverters` method and its default, if any, on a
default instance. There are 1037 of them.
- **`members`**: each public member that is not a `Param`, with its kind
(property, method, staticmethod, classmethod) and, for a method, its signature.
PySpark derives two defaults from the instance. They are recorded the way
PySpark derives them, so every run captures the same file:
- `outputCol` (`HasOutputCol`) is `{"uid_suffix": "__output"}`: the uid of
the instance followed by `__output`.
- `seed` (`HasSeed`) is `{"class_name_hash": true}`: the `hash` of the name
of the class, which differs between Python processes.
The script needs no server. It runs on official `pyspark-client` 4.3.0 with
`SPARK_CONNECT_MODE_ENABLED=1`, and reads each `Param` off the class. A model's
`params` would also read its remote attributes, such as `trees`.
### Why are the changes needed?
The native classes of `pyspark.ml.connect` and the Rust API of
`spark_connect::ml` are to follow the whole `pyspark.ml` 4.3.0 API. This golden
is the single source both sides follow:
- the Python side's `Param` objects, docs, converters and defaults;
- the Rust side's typed setters and getters
(`scripts/gen_rust_params_table.py`, to come);
- the API tests that compare each class's params and members with official
PySpark.
### Does this PR introduce _any_ user-facing change?
No. It adds a test fixture and the script that captures it.
### How was this patch tested?
- I ran the script three times on official `pyspark-client` 4.3.0, one of
them with another `PYTHONHASHSEED`. All three outputs are byte-identical.
- ruff (format and check) of the script.
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]