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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]