File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog
core/src/main/scala/org/apache/spark/sql/execution/command Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff 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 /**
Original file line number Diff line number Diff 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 ]
You can’t perform that action at this time.
0 commit comments