zhengruifeng opened a new pull request, #653: URL: https://github.com/apache/spark-connect-rust/pull/653
### What changes were proposed in this pull request? Add native Rust APIs and Rust-backed Python bindings for all six public classes in standard `pyspark.ml.stat`: `ChiSquareTest`, `Correlation`, `KolmogorovSmirnovTest`, `Summarizer`, `SummaryBuilder`, and `MultivariateGaussian`. The tests use Spark's ML helper relations. Summarizer builds the standard `aggregate_metrics` expression, including all ten metrics and optional weights. Lazy results retain models used by their input plans. The Gaussian holder preserves the mean/covariance pair; Rust includes dense and sparse `MlMatrix` storage. ### Why are the changes needed? These statistics were missing from the native Rust ML API and Python bindings. They support feature analysis and hypothesis testing without using the deprecated pandas-based ML Connect APIs. ### Does this PR introduce _any_ user-facing change? Yes. The APIs are available through Rust's `ml` exports and Python's `pyspark.ml.connect.stat` (also re-exported from `pyspark.ml.connect`). Statistical tests require Spark DataFrames and reject pandas before serialization/RPC. Summarizer takes ML vector Columns and works with grouped aggregation. Spark validates statistical arguments and schemas. The vendored standard `pyspark.ml.stat` module is unchanged. Supported operations include chi-square flattening, Pearson/Spearman correlation, normal-distribution KS tests, and mean, sum, variance, std, count, numNonZeros, max, min, normL1 and normL2. Compatibility notes document metric spelling and the Gaussian holder. ### How was this patch tested? - Official PySpark 4.3.0 fixtures capture eight helper calls and 22 weighted/unweighted summary expressions and numerical results. Rust and native Python compare against them on Spark 4.3.0. - Tests cover sparse/dense vectors, grouped summaries, constant-feature NaNs, KS numeric-string conversion, invalid inputs, pandas rejection without RPC, Gaussian object identity/mutation, and lazy upstream model ownership. - Python offline suite: 4469 passed, 8 skipped, 60 warnings, 14 subtests passed in 356.23s (0:05:56). Native live ML suite: 323 passed in 86.78s (0:01:26). Statistics suite using official PySpark: 45 passed in 4.43s. - All five upstream standard statistics tests also pass with the new native classes explicitly substituted. - Rust: five statistics tests and 682 library tests pass; all integration tests compile with and without `wasm-udf`. Formatting, workspace/default-feature Clippy with warnings denied, Ruff and the release extension build pass. - Official Connect regression gate: all 87 selected files pass, with the existing artifact/local-cluster exclusions retained. The public SQL API audit reports zero gaps after its two documented transport exclusions. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Codex (GPT-6) 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]
