Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18142#discussion_r119167774
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ---
    @@ -1152,27 +1151,27 @@ class SessionCatalog(
         // Note: the implementation of this function is a little bit 
convoluted.
         // We probably shouldn't use a single FunctionRegistry to register all 
three kinds of functions
         // (built-in, temp, and external).
    -    if (name.database.isEmpty && 
functionRegistry.functionExists(name.funcName)) {
    +    if (name.database.isEmpty && functionRegistry.functionExists(name)) {
           // This function has been already loaded into the function registry.
    -      return functionRegistry.lookupFunction(name.funcName, children)
    +      return functionRegistry.lookupFunction(name, children)
         }
     
         // If the name itself is not qualified, add the current database to it.
    -    val database = 
name.database.orElse(Some(currentDb)).map(formatDatabaseName)
    -    val qualifiedName = name.copy(database = database)
    +    val database = 
formatDatabaseName(name.database.getOrElse(getCurrentDatabase))
    +    val qualifiedName = name.copy(database = Some(database))
     
    -    if (functionRegistry.functionExists(qualifiedName.unquotedString)) {
    +    if (functionRegistry.functionExists(qualifiedName)) {
           // This function has been already loaded into the function registry.
           // Unlike the above block, we find this function by using the 
qualified name.
    -      return functionRegistry.lookupFunction(qualifiedName.unquotedString, 
children)
    +      return functionRegistry.lookupFunction(qualifiedName, children)
         }
     
         // The function has not been loaded to the function registry, which 
means
         // that the function is a permanent function (if it actually has been 
registered
         // in the metastore). We need to first put the function in the 
FunctionRegistry.
         // TODO: why not just check whether the function exists first?
         val catalogFunction = try {
    -      externalCatalog.getFunction(currentDb, name.funcName)
    --- End diff --
    
    Submitted a separate PR #18146 for easily backporting to the previous 
branch.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to