Skip to content

Commit e83194f

Browse files
committed
address comment
1 parent fc4789f commit e83194f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,12 +1343,10 @@ class SessionCatalog(
13431343

13441344
/**
13451345
* Unregister a temporary or permanent function from a session-specific [[FunctionRegistry]]
1346+
* Return true if function exists.
13461347
*/
1347-
def unregisterFunction(name: FunctionIdentifier): Unit = {
1348-
if (!functionRegistry.dropFunction(name)) {
1349-
throw new NoSuchFunctionException(
1350-
formatDatabaseName(name.database.getOrElse(currentDb)), name.funcName)
1351-
}
1348+
def unregisterFunction(name: FunctionIdentifier): Boolean = {
1349+
functionRegistry.dropFunction(name)
13521350
}
13531351

13541352
/**

sql/core/src/main/scala/org/apache/spark/sql/execution/command/functions.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ case class RefreshFunctionCommand(
267267
catalog.registerFunction(func, true)
268268
} else {
269269
// clear cached function, if not exists throw exception
270-
catalog.unregisterFunction(identifier)
270+
if (!catalog.unregisterFunction(identifier)) {
271+
throw new NoSuchFunctionException(identifier.database.get, identifier.funcName)
272+
}
271273
}
272274

273275
Seq.empty[Row]

0 commit comments

Comments
 (0)