rdblue commented on a change in pull request #25651: [SPARK-28948][SQL] Support 
passing all Table metadata in TableProvider
URL: https://github.com/apache/spark/pull/25651#discussion_r328336645
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalog.scala
 ##########
 @@ -121,41 +133,37 @@ class V2SessionCatalog(catalog: SessionCatalog, conf: 
SQLConf)
 
     val properties = 
CatalogV2Util.applyPropertiesChanges(catalogTable.properties, changes)
     val schema = CatalogV2Util.applySchemaChanges(catalogTable.schema, changes)
+    val updatedTable = catalogTable.copy(properties = properties, schema = 
schema)
 
     try {
-      catalog.alterTable(catalogTable.copy(properties = properties, schema = 
schema))
+      catalog.alterTable(updatedTable)
     } catch {
       case _: NoSuchTableException =>
         throw new NoSuchTableException(ident)
     }
 
-    loadTable(ident)
+    V1Table(updatedTable)
   }
 
   override def dropTable(ident: Identifier): Boolean = {
-    try {
-      if (loadTable(ident) != null) {
-        catalog.dropTable(
-          ident.asTableIdentifier,
-          ignoreIfNotExists = true,
-          purge = true /* skip HDFS trash */)
-        true
-      } else {
-        false
-      }
-    } catch {
-      case _: NoSuchTableException =>
-        false
+    if (tableExists(ident)) {
+      catalog.dropTable(
+        ident.asTableIdentifier,
+        ignoreIfNotExists = true,
+        purge = true /* skip HDFS trash */)
+      true
+    } else {
+      false
     }
   }
 
   override def renameTable(oldIdent: Identifier, newIdent: Identifier): Unit = 
{
     if (tableExists(newIdent)) {
       throw new TableAlreadyExistsException(newIdent)
     }
-
-    // Load table to make sure the table exists
-    loadTable(oldIdent)
+    if (!tableExists(oldIdent)) {
+      throw new NoSuchTableException(oldIdent)
+    }
 
 Review comment:
   These changes don't seem related, but look okay to me.

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