From 35442bae7a8578b6bc8e8ece3deede3b2923137b Mon Sep 17 00:00:00 2001 From: Ruifeng Zheng Date: Thu, 20 Feb 2025 11:46:51 +0900 Subject: [PATCH] [SPARK-51150][ML][FOLLOW-UP] Pass session in `OneVsRestParams.saveImpl` ### What changes were proposed in this pull request? followup of https://github.com/apache/spark/pull/49871 I don't find other similar place in jvm side ### Why are the changes needed? avoid session recreation ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? ci ### Was this patch authored or co-authored using generative AI tooling? no Closes #50003 from zhengruifeng/ml_ovr_session. Lead-authored-by: Ruifeng Zheng Co-authored-by: Hyukjin Kwon Signed-off-by: Hyukjin Kwon --- .../scala/org/apache/spark/ml/classification/OneVsRest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala b/mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala index fa543cc0dd82c..eb85791e9dbf3 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/classification/OneVsRest.scala @@ -105,7 +105,7 @@ private[ml] object OneVsRestParams extends ClassifierTypeTrait { DefaultParamsWriter.saveMetadata(instance, path, spark, extraMetadata, Some(jsonParams)) val classifierPath = new Path(path, "classifier").toString - instance.getClassifier.asInstanceOf[MLWritable].save(classifierPath) + instance.getClassifier.asInstanceOf[MLWritable].write.session(spark).save(classifierPath) } def loadImpl(