mccheah commented on a change in pull request #24798: [SPARK-27724][WIP] Implement REPLACE TABLE and REPLACE TABLE AS SELECT with V2 URL: https://github.com/apache/spark/pull/24798#discussion_r290535863
########## File path: sql/catalyst/src/main/java/org/apache/spark/sql/sources/v2/StagedTable.java ########## @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.sources.v2; + +public interface StagedTable extends Table { + + void commitStagedChanges(); Review comment: It's not immediately obvious if this API belongs in `StagedTable`, or if it should be tied to the `BatchWrite`'s `commit()` operation. The idea I had with tying it to `StagedTable` is: 1. Make the atomic swap part more explicit from the perspective of the physical plan execution, and 2. Allow both `StagedTable` and `Table` to share the same `WriteBuilder` and `BatchWrite` implementations that persist the rows, and decouple the atomic swap in this module only. If we wanted to move the swap implementation behind the `BatchWrite#commit` and `BatchWrite#abort` APIs, then it's worth asking if we need the `StagedTable` interface at all - so `TransactionalTableCatalog` would return plain `Table` objects. ---------------------------------------------------------------- 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]
