mccheah commented on a change in pull request #24798: [SPARK-27724][SQL] 
Implement REPLACE TABLE and REPLACE TABLE AS SELECT with V2
URL: https://github.com/apache/spark/pull/24798#discussion_r302753174
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala
 ##########
 @@ -440,6 +440,44 @@ case class CreateTableAsSelect(
   }
 }
 
+/**
+ * Replace a table with a v2 catalog.
+ *
+ * If the table does not exist, it will be created. The persisted table will 
have no contents
+ * as a result of this operation.
+ */
+case class ReplaceTable(
+    catalog: TableCatalog,
+    tableName: Identifier,
+    tableSchema: StructType,
+    partitioning: Seq[Transform],
+    properties: Map[String, String],
+    orCreate: Boolean) extends Command
+
+/**
+ * Replaces a table from a select query with a v2 catalog.
+ *
+ * If the table does not already exist, it will be created.
+ */
+case class ReplaceTableAsSelect(
 
 Review comment:
   Great question. I'm fairly certain that:
   - If non-atomic catalog is being used, the table will have been dropped, so 
loading the table for the query will result in an error
   - If the atomic catalog is being used, the drop part of the replace isn't 
committed yet, so the catalog should be able to load the table's contents 
before the write is committed.
   
   @rdblue - curious to hear your thoughts on the first situation. It makes a 
stronger case for trying to ban replacing tables without an atomic catalog.

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