Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17681#discussion_r125219807
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ---
    @@ -1056,6 +1056,27 @@ class SessionCatalog(
       }
     
       /**
    +   * overwirte a metastore function in the database specified in 
`funcDefinition`..
    +   * If no database is specified, assume the function is in the current 
database.
    +   */
    +  def alterFunction(funcDefinition: CatalogFunction): Unit = {
    +    val db = 
formatDatabaseName(funcDefinition.identifier.database.getOrElse(getCurrentDatabase))
    +    requireDbExists(db)
    +    val identifier = 
FunctionIdentifier(funcDefinition.identifier.funcName, Some(db))
    +    val newFuncDefinition = funcDefinition.copy(identifier = identifier)
    +    if (functionExists(identifier)) {
    +      if (functionRegistry.functionExists(identifier)) {
    +        // If we have loaded this function into the FunctionRegistry,
    +        // also drop it from there.
    +        // For a permanent function, because we loaded it to the 
FunctionRegistry
    +        // when it's first used, we also need to drop it from the 
FunctionRegistry.
    +        functionRegistry.dropFunction(identifier)
    +      }
    +      externalCatalog.alterFunction(db, newFuncDefinition)
    +    }
    --- End diff --
    
    shall we add an else branch to throw exception? Then the semantic is 
consistent with `alterTable`


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to