zhengruifeng opened a new pull request, #60656: URL: https://github.com/apache/spark/pull/60656
### What changes were proposed in this pull request? Add the shared `intermediateStorageLevel` parameter to BisectingKMeans in Scala and PySpark, including the Python constructor, `setParams`, and setter. Pass the configured level to the shared training implementation for its vector, norm, and cluster-assignment caches, and include the parameter in instrumentation. ### Why are the changes needed? BisectingKMeans currently hard-codes `MEMORY_AND_DISK` for these intermediate RDDs. Exposing the parameter lets users choose a level such as `DISK_ONLY` when training data competes for executor memory. ### Does this PR introduce _any_ user-facing change? Yes. Scala and PySpark ML users can configure `intermediateStorageLevel`, which defaults to `MEMORY_AND_DISK`. The fitted model exposes the value through its getter. Training continues to cache vectors for uncached input and norms for cached input, using the chosen storage level for either path and for cluster assignments. New API annotations use 4.5.0. This change targets master and branch-4.x. ### How was this patch tested? Extended the existing Scala default/setter checks and read/write parameter settings. Extended the existing PySpark BisectingKMeans test to cover the default, constructor, `setParams`, setter, fitted model, and estimator/model save/load. All local checks passed: - ML and MLlib `BisectingKMeansSuite` (22 tests). - `mllib/scalastyle`, `mllib/Test/scalastyle`, and `mllib/mimaReportBinaryIssues`. - Classic and Connect `test_bisecting_kmeans`, plus `DefaultValuesTests.test_java_params` (three tests, none skipped). - Ruff lint/format checks and `git diff --check`. An additional local Spark listener check observed `DISK_ONLY` for intermediate RDDs, including cluster assignments, with both cached and uncached input. It also verified cleanup after fitting and preservation of the cached input's original storage level. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Codex (GPT-6) -- 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]
