spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cloud-fan <...@git.apache.org>
Subject [GitHub] spark pull request #17681: [SPARK-20383][SQL] Supporting Create [temporary] ...
Date Mon, 03 Jul 2017 06:55:24 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message