cloud-fan commented on a change in pull request #31107: URL: https://github.com/apache/spark/pull/31107#discussion_r560004830
########## 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: The cascade behavior is from https://github.com/apache/spark/pull/21594 After #30567 , SQL temp view should have the same semantic of permanent view, so should do cascade uncache. ---------------------------------------------------------------- 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