Reo-LEI commented on a change in pull request #3323: URL: https://github.com/apache/iceberg/pull/3323#discussion_r735350470
########## File path: flink/src/main/java/org/apache/iceberg/flink/sink/CommitResult.java ########## @@ -0,0 +1,114 @@ +/* + * 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.flink.sink; + +import java.io.Serializable; +import java.util.Collection; +import org.apache.iceberg.DataFile; +import org.apache.iceberg.DeleteFile; +import org.apache.iceberg.StructLike; +import org.apache.iceberg.io.WriteResult; + +class CommitResult implements Serializable { + + private final long snapshotId; + private final long sequenceNumber; + private final int specId; + private final StructLike partition; + private final WriteResult writeResult; + + private CommitResult(long snapshotId, + long sequenceNumber, + int specId, + StructLike partition, + WriteResult writeResult) { + this.snapshotId = snapshotId; + this.sequenceNumber = sequenceNumber; + this.specId = specId; + this.partition = partition; + this.writeResult = writeResult; + } + + long snapshotId() { + return snapshotId; + } + + long sequenceNumber() { + return sequenceNumber; + } + + public int specId() { + return specId; + } + + StructLike partition() { + return partition; + } + + WriteResult writeResult() { + return writeResult; + } + + static Builder builder(long snapshotId, long sequenceNumber) { + return new Builder(snapshotId, sequenceNumber); + } + + static class Builder { + + private final long snapshotId; + private final long sequenceNumber; + private int specId; + private StructLike partition; + private final WriteResult.Builder writeResult; + + private Builder(long snapshotId, long sequenceNumber) { + this.snapshotId = snapshotId; + this.sequenceNumber = sequenceNumber; + this.specId = 0; + this.partition = null; + this.writeResult = WriteResult.builder(); + } + + Builder partition(int newSpecId, StructLike newPartition) { + this.specId = newSpecId; + this.partition = newPartition; + return this; + } + + Builder addDataFile(Collection<DataFile> files) { + writeResult.addDataFiles(files); + return this; + } + + Builder addDeleteFile(Collection<DeleteFile> files) { + writeResult.addDeleteFiles(files); + return this; + } + + Builder addReferencedDataFile(Collection<CharSequence> files) { + writeResult.addReferencedDataFiles(files); Review comment: Those only the pos-delete file referenced data files path location, and that are [collect](https://github.com/apache/iceberg/blob/6439bbb2fe8ff84d6bcf2d26f764a61b6e04cf8c/flink/src/main/java/org/apache/iceberg/flink/sink/IcebergFilesCommitter.java#L365) from committed `WriteResult`. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
