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 2020/03/19 00:29:18 UTC

[GitHub] [spark] maropu commented on a change in pull request #27185: [SPARK-30494][SQL] Avoid duplicated cached RDD when replace an existing view

maropu commented on a change in pull request #27185: [SPARK-30494][SQL] Avoid duplicated cached RDD when replace an existing view
URL: https://github.com/apache/spark/pull/27185#discussion_r394721306
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
 ##########
 @@ -125,6 +145,14 @@ case class CreateViewCommand(
         val viewIdent = tableMetadata.identifier
         checkCyclicViewReference(analyzedPlan, Seq(viewIdent), viewIdent)
 
+        // uncache the cached data before replacing an exists view
+        logInfo(s"Try to uncache ${viewIdent.quotedString} before replacing.")
+        try {
+          sparkSession.catalog.uncacheTable(viewIdent.quotedString)
+        } catch {
+          case NonFatal(e) => log.warn(e.toString, e)
+        }
 
 Review comment:
   How about just moving this pattern (`try { uncacheTable(..) } catch { case NonFatal... } `) into `CommandUtils` then using the util func from the related commands, `create view`, `drop table`, ...?

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