Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses-you committed Jul 14, 2020
1 parent c129a54 commit a956144
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Expand Up @@ -265,9 +265,10 @@ case class RefreshFunctionCommand(
// register overwrite function.
val func = catalog.getFunctionMetadata(identifier)
catalog.registerFunction(func, true)
} else {
// function is not exists, clear cached function.
} else if (catalog.isRegisteredFunction(identifier)) {
// clear cached function.
catalog.unregisterFunction(identifier, true)
} else {
throw new NoSuchFunctionException(identifier.database.get, functionName)
}

Expand Down
Expand Up @@ -3058,9 +3058,7 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {

spark.sessionState.catalog.externalCatalog.dropFunction("default", "func1")
assert(spark.sessionState.catalog.isRegisteredFunction(func))
intercept[NoSuchFunctionException] {
sql("REFRESH FUNCTION func1")
}
sql("REFRESH FUNCTION func1")
assert(!spark.sessionState.catalog.isRegisteredFunction(func))

val function = CatalogFunction(func, "test.non.exists.udf", Seq.empty)
Expand Down

0 comments on commit a956144

Please sign in to comment.