Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add unit test
  • Loading branch information
caneGuy committed Dec 27, 2018
commit ec208e02cd90a5065386510ad3f60c84d6918533
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ class SessionCatalog(
databaseExists(db) && externalCatalog.functionExists(db, name.funcName)
}

protected def failFunctionLookup(
protected[sql] def failFunctionLookup(
name: FunctionIdentifier, cause: Option[Throwable] = None): Nothing = {
throw new NoSuchFunctionException(
db = name.database.getOrElse(getCurrentDatabase), func = name.funcName, cause)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1445,4 +1445,12 @@ abstract class SessionCatalogSuite extends AnalysisTest {
}
}
}

test("SPARK-24544: test print actual failure cause when look up function failed") {
withBasicCatalog { catalog =>
intercept[NoSuchFunctionException] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test anything about the cause of the exception? maybe get the cause and assert about its message?

catalog.failFunctionLookup(FunctionIdentifier("failureFunc"), Some(new Exception("Test")))
}
}
}
}