nsivabalan commented on code in PR #11562:
URL: https://github.com/apache/hudi/pull/11562#discussion_r1664604648


##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieReplaceCommitMetadata.java:
##########
@@ -115,12 +117,32 @@ public int hashCode() {
     return result;
   }
 
-  public static <T> T fromBytes(byte[] bytes, Class<T> clazz) throws 
IOException {
+  /*public static <T> T fromBytes(byte[] bytes, Class<T> clazz) throws 
IOException {
     try {
       return fromJsonString(fromUTF8Bytes(bytes), clazz);
     } catch (Exception e) {
       throw new IOException("unable to read commit metadata", e);
     }
+  }*/
+
+  public static <T> T fromBytes(byte[] bytes, Class<T> clazz) throws 
IOException {
+    try {
+      if (bytes.length == 0) {
+        return clazz.newInstance();
+      }
+      return fromJsonString(
+          fromUTF8Bytes(
+              
convertCommitMetadataToJsonBytes(deserializeReplaceCommitMetadata(bytes), 
org.apache.hudi.avro.model.HoodieReplaceCommitMetadata.class)),
+          clazz);
+    } catch (Exception e) {
+      LOG.info("Failed to deserialize replace commit metadata as avro, trying 
json ");
+      try {

Review Comment:
   NTR: same as above. deser as avro. on exception we can do json. 
   I have not introduced the table upgrade commit time change as proposed in 
the rfc. once we introduce that, we should be able to avoid this. 



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

Reply via email to