amaliujia commented on code in PR #36904:
URL: https://github.com/apache/spark/pull/36904#discussion_r902899453
##########
sql/core/src/main/scala/org/apache/spark/sql/internal/CatalogImpl.scala:
##########
@@ -548,10 +548,20 @@ class CatalogImpl(sparkSession: SparkSession) extends
Catalog {
* @since 2.0.0
*/
override def uncacheTable(tableName: String): Unit = {
- val tableIdent =
sparkSession.sessionState.sqlParser.parseTableIdentifier(tableName)
- sessionCatalog.lookupTempView(tableIdent).map(uncacheView).getOrElse {
-
sparkSession.sharedState.cacheManager.uncacheQuery(sparkSession.table(tableName),
- cascade = true)
+ // We first try to parse `tableName` to see if it is 2 part name. If so,
then in HMS we check
+ // if it is a temp view and uncache the temp view from HMS, otherwise we
uncache it from the
+ // cache manager.
+ // if `tableName` is not 2 part name, then we directly uncache it from the
cache manager.
+ try {
+ val tableIdent =
sparkSession.sessionState.sqlParser.parseTableIdentifier(tableName)
+ sessionCatalog.lookupTempView(tableIdent).map(uncacheView).getOrElse {
Review Comment:
I might change the logic here as well: just look up the view from
SessionCatalog. If it does not exist, fall back to 3 part name logic.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]