juliuszsompolski commented on code in PR #48037:
URL: https://github.com/apache/spark/pull/48037#discussion_r1752051998
##########
core/src/test/scala/org/apache/spark/util/UtilsSuite.scala:
##########
@@ -1523,6 +1523,116 @@ class UtilsSuite extends SparkFunSuite with
ResetSystemProperties {
conf.set(SERIALIZER, "org.apache.spark.serializer.JavaSerializer")
assert(Utils.isPushBasedShuffleEnabled(conf, isDriver = true) === false)
}
+
+
+ private def throwException(): String = {
+ throw new Exception("test")
+ }
+
+ private def callDoTry(): Try[String] = {
+ Utils.doTryWithCallerStacktrace {
+ throwException()
+ }
+ }
+
+ private def callGetTry(t: Try[String]): String = {
+ Utils.getTryWithCallerStacktrace(t)
+ }
+
+ private def callGetTryAgain(t: Try[String]): String = {
+ Utils.getTryWithCallerStacktrace(t)
+ }
+
+ test("doTryWithCallerStacktrace and getTryWithCallerStacktrace") {
+ val t = callDoTry()
+
+ val e1 = intercept[Exception] {
+ callGetTry(t)
+ }
+ // Uncomment for manual inspection
+ // e.printStackTrace()
+ // Example:
+ // java.lang.Exception: test
+ // at
org.apache.spark.util.UtilsSuite.throwException(UtilsSuite.scala:1640)
+ // at
org.apache.spark.util.UtilsSuite.$anonfun$callDoTry$1(UtilsSuite.scala:1645)
Review Comment:
`assert(!st1.exists(_.getMethodName == "callDoTry"))` -> callDoTry shouldn't
be on the stack trace -> !st1.exists
`assert(st1.exists(_.getMethodName == "callGetTry"))` -> but callGetTry
should be -> st1.exists
--
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]