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



##########
File path: core/src/main/java/org/apache/iceberg/ContentFileWriter.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.iceberg;
+
+import java.io.Closeable;
+import java.util.Iterator;
+
+public interface ContentFileWriter<T, R> extends Closeable {

Review comment:
       I don't think we would require a different class for each engine. The 
file writers are currently created using an `AppenderFactory` and we could 
continue using that.
   
   Also, we would not need 3 rolling writers that are nearly identical. We 
would only need 2 because the position delete writer will be substantially 
different because of its sort order requirement.
   
   Because deletes may come in any order relative to inserts and we need to 
write out a sorted delete file, we will need to buffer the deletes in memory. 
That's not as expensive as it seems at first because the file location will be 
reused (multiple deletes in the same data file) and so the main cost is the 
number of positions that get deleted, which is the number of rows written and 
deleted in the same checkpoint per partition. The position delete writer and 
logic to roll over to a new file is probably not going to be shared. I don't 
think I would even build a rolling position delete writer unless we see real 
cases where it is needed.
   
   That leaves just the equality delete writer and the data file writer. I 
think it would be cleaner to just have two rolling file writers because the 
rolling logic is so small. I went ahead and started a PR to show what it would 
look like: https://github.com/apache/iceberg/pull/1802




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