You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/21 21:00:04 UTC

[GitHub] [spark] sunchao commented on a change in pull request #31265: [SPARK-34197][SQL] `SessionCatalog.refreshTable()` should not invalidate the relation cache for temporary views

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



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
##########
@@ -994,15 +994,17 @@ class SessionCatalog(
     // Go through temporary views and invalidate them.
     // If the database is defined, this may be a global temporary view.
     // If the database is not defined, there is a good chance this is a temp view.
-    if (name.database.isEmpty) {
-      tempViews.get(tableName).foreach(_.refresh())
+    val isTempView = if (name.database.isEmpty) {

Review comment:
       nit: the code structure here looks pretty similar to `isTemporaryTable`, and it would be nice if we can do:
   ```scala
       lookupTemporaryTable(name).map(_.refresh()).getOrElse {
         // Also invalidate the table relation cache.
         val qualifiedTableName = QualifiedTableName(dbName, tableName)
         tableRelationCache.invalidate(qualifiedTableName)
       }
   ```




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



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