sunchao commented on a change in pull request #31136:
URL: https://github.com/apache/spark/pull/31136#discussion_r555966868



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala
##########
@@ -395,9 +395,9 @@ class CatalogImpl(sparkSession: SparkSession) extends 
Catalog {
    * @since 2.0.0
    */
   override def dropTempView(viewName: String): Boolean = {
-    sparkSession.sessionState.catalog.getTempView(viewName).exists { viewDef =>
+    sparkSession.sessionState.catalog.getTempView(viewName).exists { _ =>
       sparkSession.sharedState.cacheManager.uncacheQuery(
-        sparkSession, viewDef, cascade = false)
+        sparkSession.table(viewName), cascade = false)

Review comment:
       I'm not totally sure about this. It seems common that a temporary view 
is dropped _after_ its dependent view/table is already gone, as demonstrated by 
the test failures, so this assertion will fail in those cases.
   
   Another approach is to ignore the possible non-fatal errors during query 
analysis and uncache, [similar to what's done in 
`DropTableCommand`](https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala#L239).
   
   
   




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to