This is an automated email from the ASF dual-hosted git repository.

yangjie01 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new cf804610c15e Revert "[SPARK-51691][CORE][TESTS] SerializationDebugger 
should swallow exception when try to find the reason of serialization problem"
cf804610c15e is described below

commit cf804610c15ea9d9eda9673dc0a261b810269a8f
Author: yangjie01 <yangji...@baidu.com>
AuthorDate: Fri Apr 18 17:54:54 2025 +0800

    Revert "[SPARK-51691][CORE][TESTS] SerializationDebugger should swallow 
exception when try to find the reason of serialization problem"
    
    ### What changes were proposed in this pull request?
    This reverts commit a33b9fc60cae3c0cefe0d5027da3fcdefbf8c7b8.
    
    ### Why are the changes needed?
    Revert an incorrect merge
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    - Pass GitHub Actions
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #50642 from LuciferYang/Revert-SPARK-51691.
    
    Authored-by: yangjie01 <yangji...@baidu.com>
    Signed-off-by: yangjie01 <yangji...@baidu.com>
---
 .../spark/serializer/SerializationDebugger.scala     | 11 ++---------
 .../serializer/SerializationDebuggerSuite.scala      | 20 +-------------------
 2 files changed, 3 insertions(+), 28 deletions(-)

diff --git 
a/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala 
b/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala
index 9687a0a31d01..b05babdce169 100644
--- 
a/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala
+++ 
b/core/src/main/scala/org/apache/spark/serializer/SerializationDebugger.scala
@@ -26,10 +26,8 @@ import scala.annotation.tailrec
 import scala.collection.mutable
 import scala.util.control.NonFatal
 
-import org.apache.spark.SparkRuntimeException
 import org.apache.spark.internal.Logging
 import org.apache.spark.util.SparkClassUtils
-import org.apache.spark.util.Utils
 
 private[spark] object SerializationDebugger extends Logging {
 
@@ -112,13 +110,8 @@ private[spark] object SerializationDebugger extends 
Logging {
             val elem = s"externalizable object (class ${e.getClass.getName}, 
$e)"
             visitExternalizable(e, elem :: stack)
 
-          case s: Object with java.io.Serializable if Utils.isTesting =>
-            val str = try {
-              s.toString
-            } catch {
-              case _: SparkRuntimeException => "exception in toString"
-            }
-            val elem = s"object (class ${s.getClass.getName}, $str)"
+          case s: Object with java.io.Serializable =>
+            val elem = s"object (class ${s.getClass.getName}, $s)"
             visitSerializable(s, elem :: stack)
 
           case _ =>
diff --git 
a/core/src/test/scala/org/apache/spark/serializer/SerializationDebuggerSuite.scala
 
b/core/src/test/scala/org/apache/spark/serializer/SerializationDebuggerSuite.scala
index f24502f99b27..e903cf31d69f 100644
--- 
a/core/src/test/scala/org/apache/spark/serializer/SerializationDebuggerSuite.scala
+++ 
b/core/src/test/scala/org/apache/spark/serializer/SerializationDebuggerSuite.scala
@@ -21,7 +21,7 @@ import java.io._
 
 import scala.annotation.meta.param
 
-import org.apache.spark.{SparkFunSuite, SparkRuntimeException}
+import org.apache.spark.SparkFunSuite
 
 class SerializationDebuggerSuite extends SparkFunSuite {
 
@@ -180,15 +180,6 @@ class SerializationDebuggerSuite extends SparkFunSuite {
     assert(e.getMessage.contains("SerializableClass2"))  // found debug trace 
should be present
   }
 
-  test("SPARK-51691 improveException swallow underlying exception") {
-    val e = SerializationDebugger.improveException(
-      new SerializableClassWithStringException(new NotSerializable),
-      new NotSerializableException("someClass"))
-    assert(e.getMessage.contains("exception in toString"))
-    assert(e.getMessage.contains("someClass"))
-    assert(e.getMessage.contains("SerializableClassWithStringException"))
-  }
-
   test("improveException with error in debugger") {
     // Object that throws exception in the SerializationDebugger
     val o = new SerializableClass1 {
@@ -214,15 +205,6 @@ class SerializableClass1 extends Serializable
 
 class SerializableClass2(val objectField: Object) extends Serializable
 
-class SerializableClassWithStringException(val objectField: Object) extends 
Serializable {
-  override def toString: String = {
-    // simulate the behavior of TreeNode#toString that SQLConf.get may throw 
exception
-    throw new SparkRuntimeException(errorClass = "INTERNAL_ERROR",
-      messageParameters = Map("message" -> "this is an internal error"),
-      cause = null)
-  }
-}
-
 
 class SerializableArray(val arrayField: Array[Object]) extends Serializable
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to