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

    https://github.com/apache/spark/pull/3039#discussion_r19698963
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala ---
    @@ -267,6 +267,23 @@ class SQLContext(@transient val sparkContext: 
SparkContext)
       }
     
       /**
    +   * Unregisters the temporary table with the given table name in the 
catalog. If the table has been
    +   * cached/persisted before, it can be unpersisted if required.
    +   *
    +   * @param tableName the name of the table to be unregistered.
    +   * @param unpersist whether to unpersist the table if it has been 
cached/persisted before.
    +   *
    +   * @group userf
    +   */
    +  def unregisterTempTable(tableName: String, unpersist: Boolean = false): 
Unit = {
    --- End diff --
    
    Because currently a single cached query plan can be shared by multiple 
tables:
    
    ```scala
    testData.select('key).registerTempTable("t1")
    testData.select('key).registerTempTable("t2")
    
    cacheTable("t1")
    println(isCached("t1"))  // true
    println(isCached("t2"))  // true
    
    unregisterTempTable("t2", unpersist = true)
    println(isCached("t1"))  // false
    println(isCached("t2"))  // false
    ```
    
    Maybe we should unpersist by default? Thoughts?
    
    (Agree with renaming to `dropTempTable`.)


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