httfighter commented on a change in pull request #24440: [SPARK-27545] [SQL] 
Uncache table needs to delete the temporary view …
URL: https://github.com/apache/spark/pull/24440#discussion_r277983766
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala
 ##########
 @@ -442,7 +442,11 @@ class CatalogImpl(sparkSession: SparkSession) extends 
Catalog {
   override def uncacheTable(tableName: String): Unit = {
     val tableIdent = 
sparkSession.sessionState.sqlParser.parseTableIdentifier(tableName)
     val cascade = !sessionCatalog.isTemporaryTable(tableIdent)
-    
sparkSession.sharedState.cacheManager.uncacheQuery(sparkSession.table(tableName),
 cascade)
+    val wasCached = 
Try(sparkSession.catalog.isCached(tableIdent.unquotedString)).getOrElse(false)
 
 Review comment:
   @viirya Thank you! 
   I didn't notice  the `isCached `method in `CatalogImpl`. Therefore, I 
mimicked the usage in `tables.scala` to avoid exceptions.
     In` tables.scala`, 
   ```
         // If an exception is thrown here we can just assume the table is 
uncached;
         // this can happen with Hive tables when the underlying catalog is 
in-memory.
         val wasCached = 
Try(sparkSession.catalog.isCached(oldName.unquotedString)).getOrElse(false)
   ```
   Now I am modifying to use the `isCached  `provided by `CatalogImpl ` without 
considering this exception.

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


With regards,
Apache Git Services

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

Reply via email to