This is an automated email from the ASF dual-hosted git repository. ruifengz pushed a commit to branch branch-4.0 in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.0 by this push: new d8bbbfa770a6 revert '[SPARK-51333][ML][PYTHON][CONNECT] Unwrap InvocationTargetException thrown in MLUtils.loadOperator' from 4.0 d8bbbfa770a6 is described below commit d8bbbfa770a60a98e2a140eb270b5dc79e349f3a Author: Ruifeng Zheng <ruife...@apache.org> AuthorDate: Wed Apr 2 09:35:19 2025 +0800 revert '[SPARK-51333][ML][PYTHON][CONNECT] Unwrap InvocationTargetException thrown in MLUtils.loadOperator' from 4.0 revert https://github.com/apache/spark/pull/50478 from 4.0 due to compilation error Closes #50485 from zhengruifeng/revert_4d7639dbefc193d31ace8744ab16fb1f2959c1a8. Authored-by: Ruifeng Zheng <ruife...@apache.org> Signed-off-by: Ruifeng Zheng <ruife...@apache.org> --- python/pyspark/ml/tests/test_classification.py | 5 ----- .../scala/org/apache/spark/sql/connect/ml/MLUtils.scala | 13 ++++--------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/python/pyspark/ml/tests/test_classification.py b/python/pyspark/ml/tests/test_classification.py index 57e4c0ef86dc..5c793dc344c7 100644 --- a/python/pyspark/ml/tests/test_classification.py +++ b/python/pyspark/ml/tests/test_classification.py @@ -21,7 +21,6 @@ from shutil import rmtree import numpy as np -from pyspark.errors import PySparkException from pyspark.ml.linalg import Vectors, Matrices from pyspark.sql import DataFrame, Row from pyspark.ml.classification import ( @@ -979,10 +978,6 @@ class ClassificationTestsMixin: model2 = MultilayerPerceptronClassificationModel.load(d) self.assertEqual(str(model), str(model2)) - def test_invalid_load_location(self): - with self.assertRaisesRegex(PySparkException, "Path does not exist"): - LogisticRegression.load("invalid_location") - class ClassificationTests(ClassificationTestsMixin, ReusedSQLTestCase): pass diff --git a/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/ml/MLUtils.scala b/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/ml/MLUtils.scala index ede8272d4b8b..6088a80649d9 100644 --- a/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/ml/MLUtils.scala +++ b/sql/connect/server/src/main/scala/org/apache/spark/sql/connect/ml/MLUtils.scala @@ -415,15 +415,10 @@ private[ml] object MLUtils { if (operators.isEmpty || !operators.contains(name)) { throw MlUnsupportedException(s"Unsupported read for $name") } - try { - operators(name) - .getMethod("load", classOf[String]) - .invoke(null, path) - .asInstanceOf[T] - } catch { - case e: InvocationTargetException if e.getCause != null => - throw e.getCause - } + operators(name) + .getMethod("load", classOf[String]) + .invoke(null, path) + .asInstanceOf[T] } /** --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org