yihua commented on code in PR #12597:
URL: https://github.com/apache/hudi/pull/12597#discussion_r1934872306


##########
hudi-common/src/main/java/org/apache/hudi/common/util/HoodieRecordUtils.java:
##########
@@ -133,4 +142,25 @@ public static String 
getCurrentLocationInstant(HoodieRecord<?> record) {
     }
     return null;
   }
+
+  public static <T> boolean isCustomDeleteRecord(T record,
+                                                 Schema schema,
+                                                 Properties props,
+                                                 Function<T, Object> 
valueFetcher) {
+    if (!hasCustomDeleteConfigs(props)) {
+      return false;
+    }
+    String deleteKeyField = props.getProperty(DELETE_KEY);
+    if (schema.getField(deleteKeyField) == null) {
+      return false;
+    }
+    Object deleteMarker = valueFetcher.apply(record);
+    return deleteMarker != null
+        && props.getProperty(DELETE_MARKER).equals(deleteMarker.toString());
+  }
+
+  public static boolean hasCustomDeleteConfigs(Properties props) {
+    return !StringUtils.isNullOrEmpty(props.getProperty(DELETE_KEY))
+        && !StringUtils.isNullOrEmpty(props.getProperty(DELETE_MARKER));
+  }

Review Comment:
   Could we avoid per-record check of these?



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