codope commented on code in PR #11597:
URL: https://github.com/apache/hudi/pull/11597#discussion_r1705604341


##########
hudi-common/src/main/java/org/apache/hudi/metadata/MetadataPartitionType.java:
##########
@@ -137,6 +327,37 @@ public String getFileIdPrefix() {
     return fileIdPrefix;
   }
 
+  public int getRecordType() {
+    return recordType;
+  }
+
+  /**
+   * Construct metadata payload from the given record.
+   */
+  public void constructMetadataPayload(HoodieMetadataPayload payload, 
GenericRecord record) {
+    throw new UnsupportedOperationException("MetadataPayload construction not 
supported for partition type: " + this);
+  }
+
+  /**
+   * Merge old and new metadata payloads. By default, it returns the newer 
payload.
+   * Implementations can override this method to merge the payloads depending 
on the partition type.
+   */
+  public HoodieMetadataPayload combineMetadataPayloads(HoodieMetadataPayload 
older, HoodieMetadataPayload newer) {
+    return newer;
+  }
+
+  /**
+   * Get the metadata partition type for the given record type.
+   */
+  public static MetadataPartitionType get(int type) {
+    for (MetadataPartitionType partitionType : values()) {
+      if (partitionType.getRecordType() == type) {
+        return partitionType;
+      }
+    }

Review Comment:
   makes sense but at the moment this loop is very cheap as ooposed ot 
constructing map.



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