rdblue commented on a change in pull request #1738:
URL: https://github.com/apache/iceberg/pull/1738#discussion_r519989586



##########
File path: 
spark3/src/main/java/org/apache/spark/sql/connector/write/RowLevelOperationsBuilder.java
##########
@@ -0,0 +1,30 @@
+/*
+ * 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.connector.write;
+
+import org.apache.spark.sql.connector.read.Scan;
+
+// TODO: how to represent merge-on-read?
+// Option 1: Introduce DeltaBatchWrite that should be returned for 
merge-on-read only, use BatchWrite for copy-on-write
+// Option 2: Introduce DeltaBatchWrite with keepUnchanged flag and use that 
flag to do copy-on-write/merge-on-read
+public interface RowLevelOperationsBuilder {

Review comment:
       I like option 1. The doc proposed option 2, but the main benefit there 
was being able to get ID information for rows and pass the rows back with the 
operation for that row. For example, a deleted row would be passed back using 
`delete(idValues)`.
   
   Now that we have a better idea how this is going to work, I don't think it 
is a good idea to mix the row-level delta operation with the file-replace 
operation. There's no need to add row ID information to the replace operation 
and no need to add additional write interfaces for it.
   
   Also, the plans for each case are different. Deleted rows can be discarded 
immediately for replace, and kept rows can be discarded immediately for 
row-level changes. Trying to unify those two plans just to be able to call 
`delete` or `keep` when those aren't needed doesn't make much sense any more.
   
   I'll update the proposal doc to option 1. Do you agree?




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