Skip to content

[SPARK-62504][CONNECT][PYTHON] Delegate standard ML evaluator operations to Rust - #1008

Closed
zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:feature/standard-evaluators-rust
Closed

zhengruifeng wants to merge 1 commit into
apache:masterfrom
zhengruifeng:feature/standard-evaluators-rust

Conversation

@zhengruifeng

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Route all six concrete classes in pyspark.ml.evaluation through the existing Rust evaluators for evaluation and persistence. This covers BinaryClassificationEvaluator, MulticlassClassificationEvaluator, MultilabelClassificationEvaluator, RegressionEvaluator, ClusteringEvaluator and RankingEvaluator.

Python setters update native parameters immediately. The public Evaluator.evaluate(dataset, params) still applies a nonempty parameter map to a copy and calls its _evaluate method. Python subclasses can override that method or select a different JVM evaluator. Both evaluation and saving use the selected JVM class.

The standard module loads the original PySpark 4.3.0 definitions from _upstream/evaluation.py. The existing compatibility imports refer to the same classes.

Why are the changes needed?

Standard PySpark callers previously built evaluation requests in Python. The standard Python and Rust APIs can now share the same request implementation, and the upstream Python evaluator tests exercise the Rust implementation. SPARK-62504

Does this PR introduce any user-facing change?

No. The public Python signatures, metric direction, saved-evaluator format and dependencies are preserved.

How was this patch tested?

  • Ran the official PySpark evaluation, tuning, pipeline and ALS suites against the drop-in client. 26 tests passed and four pipeline tests were skipped. All nine upstream evaluator tests passed.
  • Ran 128 live Python tests, including all 83 metric configurations, input validation, per-call parameter overrides and saved validators. Six tests disabled Python request construction while evaluating, saving and loading.
  • Exchanged all six saved evaluators in both directions with official PySpark 4.3.0. The loaded evaluators preserved UIDs, explicit parameters, metric directions and scores. The Rust-backed process ran with Python protobuf, gRPC, Py4J and optional ML dependencies blocked.
  • Compared public members and signatures with official PySpark. Verified custom JVM-class dispatch and writes against both clients. The offline ML suites had 2,452 passes, 68 skips and four warnings from existing model finalizers.
  • Ran 864 Rust library tests and 10 integration tests covering evaluator fixtures, request replay and live Spark. Compiled all integration tests with and without wasm-udf. Checked formatting, Clippy, Ruff, generated stubs, type annotations and vendored source.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: OpenAI Codex (GPT-6)

This pull request and its description were written by Isaac.

…ons to Rust

Co-authored-by: Isaac <no-reply@databricks.com>
@zhengruifeng
zhengruifeng deleted the feature/standard-evaluators-rust branch December 1, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant