Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ulysses-you committed Jun 22, 2020
1 parent 5d5fe71 commit 4ba345b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Expand Up @@ -1885,14 +1885,14 @@ class Analyzer(
}

/**
* Replaces [[UnresolvedFunction]]s with concrete [[Expression]]s.
* Replaces [[UnresolvedFunction]]s and [[UnresolvedFunc]] with concrete [[Expression]]s.
*/
object ResolveFunctions extends Rule[LogicalPlan] {
val trimWarningEnabled = new AtomicBoolean(true)
def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsUp {
case RefreshFunction(UnresolvedFunc(multipartIdent)) =>
val funcIdent = parseSessionCatalogFunctionIdentifier(multipartIdent, "REFRESH FUNCTION")
ResolveFunctions(ResolvedFunc(currentCatalog, funcIdent))
case UnresolvedFunc(multipartIdent) =>
val funcIdent = parseSessionCatalogFunctionIdentifier(multipartIdent, s"${plan.nodeName}")
ResolvedFunc(currentCatalog, funcIdent)

case q: LogicalPlan =>
q transformExpressions {
Expand Down
Expand Up @@ -2214,7 +2214,7 @@ class DataSourceV2SQLSuite
val e = intercept[AnalysisException] {
sql("REFRESH FUNCTION testcat.ns1.ns2.fun")
}
assert(e.message.contains("REFRESH FUNCTION is only supported in v1 catalog"))
assert(e.message.contains("RefreshFunction is only supported in v1 catalog"))

val e1 = intercept[AnalysisException] {
sql("REFRESH FUNCTION default.ns1.ns2.fun")
Expand Down
Expand Up @@ -3035,14 +3035,14 @@ abstract class DDLSuite extends QueryTest with SQLTestUtils {
val msg = intercept[AnalysisException] {
sql("REFRESH FUNCTION md5")
}.getMessage
assert(msg.contains("Cannot refresh native function"))
assert(msg.contains("Cannot refresh builtin function"))

withUserDefinedFunction("func1" -> true) {
sql("CREATE TEMPORARY FUNCTION func1 AS 'test.org.apache.spark.sql.MyDoubleAvg'")
val msg = intercept[AnalysisException] {
sql("REFRESH FUNCTION func1")
}.getMessage
assert(msg.contains("Cannot refresh temp function"))
assert(msg.contains("Cannot refresh temporary function"))
}

withUserDefinedFunction("func1" -> false) {
Expand Down

0 comments on commit 4ba345b

Please sign in to comment.