You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/05/04 17:20:11 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #24221: [SPARK-27248][SQL] refresh table should recreate cache with same cache name and storage level

dongjoon-hyun commented on a change in pull request #24221: [SPARK-27248][SQL] refresh table should recreate cache with same cache name and storage level
URL: https://github.com/apache/spark/pull/24221#discussion_r280988926
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala
 ##########
 @@ -492,11 +492,17 @@ class CatalogImpl(sparkSession: SparkSession) extends Catalog {
 
     // If this table is cached as an InMemoryRelation, drop the original
     // cached version and make the new version cached lazily.
-    if (isCached(table)) {
-      // Uncache the logicalPlan.
+    val cache = sparkSession.sharedState.cacheManager.lookupCachedData(table)
+    if (cache.nonEmpty) {
+      // save the cache name and cache level for recreation
+      val cacheName = cache.get.cachedRepresentation.cacheBuilder.tableName
+      val cacheLevel = cache.get.cachedRepresentation.cacheBuilder.storageLevel
+
+      // uncache the logical plan.
       sparkSession.sharedState.cacheManager.uncacheQuery(table, cascade = true)
-      // Cache it again.
-      sparkSession.sharedState.cacheManager.cacheQuery(table, Some(tableIdent.table))
+
+      // recache with the same name.
 
 Review comment:
   nit.
   ```
   - // recache with the same name.
   + // recache with the same name and cache level.
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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