File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
core/src/main/scala/org/apache/spark/util Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -819,7 +819,7 @@ private[spark] object Utils extends Logging {
819819 var firstUserFile = " <unknown>"
820820 var firstUserLine = 0
821821 var insideSpark = true
822- var userCallStack = new ArrayBuffer [String ]
822+ var callStack = new ArrayBuffer [String ]() :+ " <unknown> "
823823
824824 for (el <- trace) {
825825 if (insideSpark) {
@@ -830,20 +830,21 @@ private[spark] object Utils extends Logging {
830830 } else {
831831 el.getMethodName
832832 }
833+ callStack(0 ) = el.toString // Put last Spark method on top of the stack trace.
833834 } else {
834835 firstUserLine = el.getLineNumber
835836 firstUserFile = el.getFileName
836- userCallStack += el.toString
837+ callStack += el.toString
837838 insideSpark = false
838839 }
839840 } else {
840- userCallStack += el.toString
841+ callStack += el.toString
841842 }
842843 }
843- val userCallStackDepth = System .getProperty(" spark.callstack.depth" , " 20" ).toInt
844+ val callStackDepth = System .getProperty(" spark.callstack.depth" , " 20" ).toInt
844845 CallSite (
845846 short = " %s at %s:%s" .format(lastSparkMethod, firstUserFile, firstUserLine),
846- long = userCallStack .take(userCallStackDepth ).mkString(" \n " ))
847+ long = callStack .take(callStackDepth ).mkString(" \n " ))
847848 }
848849
849850 /** Return a string containing part of a file from byte 'start' to 'end'. */
You can’t perform that action at this time.
0 commit comments