Skip to content

Commit

Permalink
ut nit
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses-you committed Jun 24, 2020
1 parent a38d656 commit cdea55b
Showing 1 changed file with 6 additions and 6 deletions.
Expand Up @@ -3052,25 +3052,25 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {

val func = FunctionIdentifier("func1", Some("default"))
sql("CREATE FUNCTION func1 AS 'test.org.apache.spark.sql.MyDoubleAvg'")
assert(spark.sessionState.catalog.isRegisteredFunction(func) == false)
assert(!spark.sessionState.catalog.isRegisteredFunction(func))
sql("REFRESH FUNCTION func1")
assert(spark.sessionState.catalog.isRegisteredFunction(func) == true)
assert(spark.sessionState.catalog.isRegisteredFunction(func))

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

val function = CatalogFunction(func, "test.non.exists.udf", Seq.empty)
spark.sessionState.catalog.createFunction(function, false)
assert(spark.sessionState.catalog.isRegisteredFunction(func) == false)
assert(!spark.sessionState.catalog.isRegisteredFunction(func))
val err = intercept[AnalysisException] {
sql("REFRESH FUNCTION func1")
}.getMessage
assert(err.contains("Can not load class"))
assert(spark.sessionState.catalog.isRegisteredFunction(func) == false)
assert(!spark.sessionState.catalog.isRegisteredFunction(func))
}
}
}
Expand Down

0 comments on commit cdea55b

Please sign in to comment.