JingsongLi commented on code in PR #6202:
URL: https://github.com/apache/paimon/pull/6202#discussion_r2361821492
##########
paimon-core/src/main/java/org/apache/paimon/table/sink/BatchTableWrite.java:
##########
@@ -29,14 +29,14 @@
* @since 0.4.0
*/
@Public
-public interface BatchTableWrite extends TableWrite {
+public interface BatchTableWrite<T> extends TableWrite {
Review Comment:
Never modify this, this is public API.
##########
paimon-core/src/main/java/org/apache/paimon/table/format/FormatTableFileWrite.java:
##########
@@ -0,0 +1,132 @@
+/*
+ * 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.paimon.table.format;
+
+import org.apache.paimon.CoreOptions;
+import org.apache.paimon.data.BinaryRow;
+import org.apache.paimon.data.InternalRow;
+import org.apache.paimon.deletionvectors.BucketedDvMaintainer;
+import org.apache.paimon.format.FileFormat;
+import org.apache.paimon.fs.CommittablePositionOutputStream;
+import org.apache.paimon.fs.FileIO;
+import org.apache.paimon.io.DataFileMeta;
+import org.apache.paimon.io.DataFilePathFactory;
+import org.apache.paimon.operation.MemoryFileStoreWrite;
+import org.apache.paimon.types.RowType;
+import org.apache.paimon.utils.CommitIncrement;
+import org.apache.paimon.utils.FileStorePathFactory;
+import org.apache.paimon.utils.RecordWriter;
+
+import javax.annotation.Nullable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.function.Function;
+
+import static org.apache.paimon.format.FileFormat.fileFormat;
+
+/** File write for format table. */
+public class FormatTableFileWrite extends MemoryFileStoreWrite<InternalRow> {
Review Comment:
Can we not use `MemoryFileStoreWrite`? Just create a new class for it.
##########
paimon-common/src/main/java/org/apache/paimon/fs/CommittablePositionOutputStream.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.paimon.fs;
+
+import java.io.IOException;
+
+/**
+ * CommittablePositionOutputStream provides a way to write to a file and get a
committer that can
+ * commit.
+ */
+public abstract class CommittablePositionOutputStream extends
PositionOutputStream {
Review Comment:
Or name this to `TwoPhaseOutputStream`?
##########
paimon-common/src/main/java/org/apache/paimon/fs/RenameTempFileCommittablePositionOutputStream.java:
##########
@@ -0,0 +1,145 @@
+/*
+ * 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.paimon.fs;
+
+import org.apache.paimon.annotation.Public;
+
+import java.io.IOException;
+import java.util.UUID;
+
+/**
+ * A {@link CommittablePositionOutputStream} implementation that writes to a
temporary file and
+ * commits by renaming to the target path. This follows HDFS-style commit
semantics.
+ */
+@Public
+public class RenameTempFileCommittablePositionOutputStream extends
CommittablePositionOutputStream {
Review Comment:
`RenamingTwoPhaseOutputStream`
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]