imback82 commented on a change in pull request #30774:
URL: https://github.com/apache/spark/pull/30774#discussion_r543109318



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
##########
@@ -195,16 +195,21 @@ case class AlterTableRenameCommand(
       DDLUtils.verifyAlterTableType(catalog, table, isView)
       // 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)
-      if (wasCached) {
+      // If `optStorageLevel` is defined, the old table was cached.
+      val optStorageLevel = Try {

Review comment:
       `lookupCachedData` doesn't throw an exception. I believe the existing 
code is wrapped in `Try` because `isCached` is calling `spark.table` (could be 
related to "this can happen with Hive tables when the underlying catalog is 
in-memory"). So, I was keeping the same behavior.
   
   Do you think `Try` can be removed?
   




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