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

    https://github.com/apache/spark/pull/13156#discussion_r63757822
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/ddl.scala ---
    @@ -126,24 +126,9 @@ case class RefreshTable(tableIdent: TableIdentifier)
       extends RunnableCommand {
     
       override def run(sparkSession: SparkSession): Seq[Row] = {
    -    // Refresh the given table's metadata first.
    -    sparkSession.sessionState.catalog.refreshTable(tableIdent)
    -
    -    // If this table is cached as a InMemoryColumnarRelation, drop the 
original
    -    // cached version and make the new version cached lazily.
    -    val logicalPlan = 
sparkSession.sessionState.catalog.lookupRelation(tableIdent)
    -    // Use lookupCachedData directly since RefreshTable also takes 
databaseName.
    -    val isCached = 
sparkSession.cacheManager.lookupCachedData(logicalPlan).nonEmpty
    -    if (isCached) {
    -      // Create a data frame to represent the table.
    -      // TODO: Use uncacheTable once it supports database name.
    -      val df = Dataset.ofRows(sparkSession, logicalPlan)
    -      // Uncache the logicalPlan.
    -      sparkSession.cacheManager.tryUncacheQuery(df, blocking = true)
    -      // Cache it again.
    -      sparkSession.cacheManager.cacheQuery(df, Some(tableIdent.table))
    -    }
    --- End diff --
    
    The above logics are moved to `sparkSession.catalog.refreshTable`


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