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



##########
File path: core/src/main/java/org/apache/iceberg/ManifestFiles.java
##########
@@ -149,6 +160,33 @@ private ManifestFiles() {
     throw new UnsupportedOperationException("Cannot write manifest for table 
version: " + formatVersion);
   }
 
+  private static org.apache.avro.Schema getManifestAvroSchema() {
+    return AvroSchemaUtil.convert(ManifestFile.schema(), ImmutableMap.of(
+        ManifestFile.schema().asStruct(), GenericManifestFile.class.getName(),
+        ManifestFile.PARTITION_SUMMARY_TYPE, 
GenericPartitionFieldSummary.class.getName()
+    ));
+  }
+
+  public static byte[] encode(ManifestFile manifestFile) throws IOException {
+    try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
+      BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(out, null);
+      DatumWriter<GenericManifestFile> writer = new 
GenericAvroWriter<>(getManifestAvroSchema());
+      writer.write((GenericManifestFile) manifestFile, encoder);

Review comment:
       hmm. I am not sure if we should tie Flink state serialization to Iceberg 
serialization




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