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

    https://github.com/apache/spark/pull/13706#discussion_r118989451
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ---
    @@ -1090,6 +1090,24 @@ class SessionCatalog(
         }
       }
     
    +  /** Create a temporary macro. */
    +  def createTempMacro(
    +      name: String,
    +      info: ExpressionInfo,
    +      functionBuilder: FunctionBuilder): Unit = {
    +    if (functionRegistry.functionExists(name)) {
    +      throw new AnalysisException(s"Function $name already exists")
    +    }
    +    functionRegistry.registerFunction(name, info, functionBuilder)
    +  }
    +
    +  /** Drop a temporary macro. */
    +  def dropTempMacro(name: String, ignoreIfNotExists: Boolean): Unit = {
    +    if (!functionRegistry.dropMacro(name) && !ignoreIfNotExists) {
    +      throw new NoSuchTempMacroException(name)
    --- End diff --
    
    ```
    hive>  DROP TEMPORARY MACRO max;
    OK
    Time taken: 0.01 seconds
    hive> select max(3) from t1;
    OK
    3
    ```
    
    After we drop the macro, the existing function works well. That means, we 
did not delete the original built-in functions. The built-in function will not 
be dropped by ` DROP TEMPORARY MACRO`. After we drop the macro with the same 
name, the original function `max` is using the original built-in function. 



---
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