zhengruifeng opened a new pull request, #60602: URL: https://github.com/apache/spark/pull/60602
### What changes were proposed in this pull request? Add the shared `intermediateStorageLevel` parameter to LDA in Scala and PySpark, including the Python constructor, `setParams`, and setter. Use the configured storage level when the online optimizer persists its training instances, and log the parameter in instrumentation. ### Why are the changes needed? LDA currently hard-codes `MEMORY_AND_DISK` for its intermediate training instances. Exposing this parameter lets users choose a storage level such as `DISK_ONLY` when training data competes for executor memory. ### Does this PR introduce _any_ user-facing change? Yes. Scala and PySpark users can configure `intermediateStorageLevel` for the online optimizer. The default remains `MEMORY_AND_DISK`, and cached input still bypasses internal persistence. The fitted model exposes the parameter through its getter. EM's graph caching is unchanged. New API annotations use 4.5.0 following the branch-4.4 cut. 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 online LDA test to cover the default, constructor, `setParams`, setter, fitted model, and estimator/model save/load. All local checks passed: - `mllib/testOnly org.apache.spark.ml.clustering.LDASuite` (15 tests). - `mllib/scalastyle`, `mllib/Test/scalastyle`, and `mllib/mimaReportBinaryIssues`. - Classic and Connect `test_local_lda` and `test_distributed_lda`, plus `DefaultValuesTests.test_java_params` (five tests, none skipped). - Ruff lint/format checks and `git diff --check`. An additional local Spark listener check observed `DISK_ONLY` on the training-instances RDD for online LDA with uncached input and confirmed cleanup after fitting. With cached input or the EM optimizer, that RDD remained at `NONE`, preserving the existing persistence guards. ### 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]
