danny0405 commented on code in PR #12224:
URL: https://github.com/apache/hudi/pull/12224#discussion_r1843498406


##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieCommitMetadata.java:
##########
@@ -500,10 +501,13 @@ public static <T> T fromBytes(byte[] bytes, Class<T> 
clazz) throws IOException {
       if (bytes.length == 0) {
         return clazz.newInstance();
       }
-      return fromJsonString(
-          fromUTF8Bytes(
-              
convertCommitMetadataToJsonBytes(deserializeCommitMetadata(bytes), 
org.apache.hudi.avro.model.HoodieCommitMetadata.class)),
-          clazz);
+      try {
+        return 
fromJsonString(fromUTF8Bytes(convertCommitMetadataToJsonBytes(deserializeCommitMetadata(bytes),
 org.apache.hudi.avro.model.HoodieCommitMetadata.class)), clazz);
+      } catch (Exception e) {
+        // fall back to the alternative method (0.x)
+        LOG.warn("Primary method failed; trying alternative deserialization 
method.", e);

Review Comment:
   We should migrate to @bvaradar 's new SER/DE API instead of catching 
exceptions: https://github.com/apache/hudi/pull/11923



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