-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-47833][SQL][CORE] Supply caller stackstrace for checkAndGlobPathIfNecessary AnalysisException #46028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-47833][SQL][CORE] Supply caller stackstrace for checkAndGlobPathIfNecessary AnalysisException #46028
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,6 +128,42 @@ class ThreadUtilsSuite extends SparkFunSuite { | |
| ) | ||
| } | ||
|
|
||
| test("wrapCallerStacktrace") { | ||
|
||
| var runnerThreadName: String = null | ||
| var exception: Throwable = null | ||
| val t = new Thread() { | ||
| override def run(): Unit = { | ||
| runnerThreadName = Thread.currentThread().getName | ||
| internalMethod() | ||
| } | ||
| private def internalMethod(): Unit = { | ||
| throw new RuntimeException(s"Error occurred on $runnerThreadName") | ||
| } | ||
| } | ||
| t.setDaemon(true) | ||
| t.setUncaughtExceptionHandler { case (_, e) => exception = e } | ||
| t.start() | ||
| t.join() | ||
|
|
||
| ThreadUtils.wrapCallerStacktrace(exception, s"run in separate thread: $runnerThreadName") | ||
|
|
||
| assert(exception.getStackTrace.mkString("\n").contains( | ||
|
||
| "internalMethod"), | ||
| "stack trace does not contain real exception stack trace" | ||
| ) | ||
| assert(exception.getStackTrace.mkString("\n").contains( | ||
| s"... run in separate thread: $runnerThreadName ..."), | ||
| "stack trace does not contain expected place holder" | ||
| ) | ||
| assert(exception.getStackTrace.mkString("\n").contains( | ||
| "org.scalatest.Suite.run"), | ||
| "stack trace does not contain caller stack trace" | ||
| ) | ||
| assert(exception.getStackTrace.mkString("\n").contains("ThreadUtils.scala") === false, | ||
|
||
| "stack trace contains unexpected references to ThreadUtils" | ||
| ) | ||
| } | ||
|
|
||
| test("parmap should be interruptible") { | ||
| val t = new Thread() { | ||
| setDaemon(true) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.