chenjunjiedada commented on a change in pull request #1477:
URL: https://github.com/apache/iceberg/pull/1477#discussion_r493167076



##########
File path: core/src/main/java/org/apache/iceberg/avro/GenericAvroReader.java
##########
@@ -83,6 +83,7 @@ private ReadBuilder(ClassLoader loader) {
         return ValueReaders.record(fields, record);
 
       } catch (ClassNotFoundException e) {
+        e.printStackTrace();

Review comment:
       Do we need this stack? Why not print the message?

##########
File path: flink/src/main/java/org/apache/iceberg/flink/sink/FlinkManifest.java
##########
@@ -0,0 +1,105 @@
+/*
+ * 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.IOException;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.FileFormat;
+import org.apache.iceberg.ManifestFile;
+import org.apache.iceberg.ManifestFiles;
+import org.apache.iceberg.ManifestWriter;
+import org.apache.iceberg.PartitionSpec;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.encryption.EncryptionManager;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.io.LocationProvider;
+import org.apache.iceberg.io.OutputFile;
+import org.apache.iceberg.io.OutputFileFactory;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+
+class FlinkManifest {
+  private static final int ICEBERG_FORMAT_VERSION = 2;

Review comment:
       Why use format v2? Can we use the version from the table as constructor 
parameter? That could keep consistency, I think.

##########
File path: 
flink/src/main/java/org/apache/iceberg/flink/sink/IcebergFilesCommitter.java
##########
@@ -149,7 +156,7 @@ public void snapshotState(StateSnapshotContext context) 
throws Exception {
     LOG.info("Start to flush snapshot state to state backend, table: {}, 
checkpointId: {}", table, checkpointId);
 
     // Update the checkpoint state.
-    dataFilesPerCheckpoint.put(checkpointId, 
ImmutableList.copyOf(dataFilesOfCurrentCheckpoint));
+    dataFilesPerCheckpoint.put(checkpointId, writeToManifest(checkpointId));

Review comment:
       Since we are now writing manifest to state, do we need to rename 
datafiles related variables to manifest context?

##########
File path: 
flink/src/main/java/org/apache/iceberg/flink/sink/IcebergFilesCommitter.java
##########
@@ -117,6 +120,10 @@ public void initializeState(StateInitializationContext 
context) throws Exception
     // Open the table loader and load the table.
     this.tableLoader.open(hadoopConf.get());
     this.table = tableLoader.loadTable();
+
+    int subTaskId = getRuntimeContext().getIndexOfThisSubtask();
+    int attemptId = getRuntimeContext().getAttemptNumber();
+    this.flinkManifestFactory = FlinkManifest.createFactory(table, flinkJobId, 
subTaskId, attemptId);

Review comment:
       I see the `createFactory` definition is `createFactory(Table table, 
String flinkJobId, int partitionId, long taskId)` . Do we need to make 
parameters as same as here?




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