viirya commented on a change in pull request #31107:
URL: https://github.com/apache/spark/pull/31107#discussion_r560346835



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala
##########
@@ -417,17 +411,25 @@ class CatalogImpl(sparkSession: SparkSession) extends 
Catalog {
    */
   override def dropGlobalTempView(viewName: String): Boolean = {
     sparkSession.sessionState.catalog.getGlobalTempView(viewName).exists { 
viewDef =>
-      try {
-        val plan = sparkSession.sessionState.executePlan(viewDef)
-        sparkSession.sharedState.cacheManager.uncacheQuery(
-          sparkSession, plan.analyzed, cascade = false)
-      } catch {
-        case NonFatal(_) => // ignore
-      }
+      uncacheView(viewDef)
       sessionCatalog.dropGlobalTempView(viewName)
     }
   }
 
+  private def uncacheView(viewDef: LogicalPlan): Unit = {
+    try {
+      val viewText = viewDef match {
+        case v: View => v.desc.viewText
+        case _ => None
+      }
+      val plan = sparkSession.sessionState.executePlan(viewDef)
+      sparkSession.sharedState.cacheManager.uncacheQuery(
+        sparkSession, plan.analyzed, cascade = viewText.isDefined)

Review comment:
       Hmm, so this is not for technical reason but to keep behavior unchanged, 
is it correct?




----------------------------------------------------------------
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:
us...@infra.apache.org



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

Reply via email to