nsivabalan commented on a change in pull request #1819:
URL: https://github.com/apache/hudi/pull/1819#discussion_r455440158



##########
File path: hudi-spark/src/main/java/org/apache/hudi/DataSourceUtils.java
##########
@@ -176,11 +177,21 @@ public static KeyGenerator 
createKeyGenerator(TypedProperties props) throws IOEx
   /**
    * Create a payload class via reflection, passing in an ordering/precombine 
value.
    */
-  public static HoodieRecordPayload createPayload(String payloadClass, 
GenericRecord record, Comparable orderingVal)
-      throws IOException {
+  public static HoodieRecordPayload createPayload(String payloadClass, 
GenericRecord record,
+                                                  Comparable orderingVal,
+                                                  String deleteField) throws 
IOException {
     try {
-      return (HoodieRecordPayload) ReflectionUtils.loadClass(payloadClass,
-          new Class<?>[] {GenericRecord.class, Comparable.class}, record, 
orderingVal);
+      HoodieRecordPayload payload = null;
+      if (payloadClass.equals(OverwriteWithLatestAvroPayload.class.getName()) 
&&
+              !deleteField.isEmpty()) {

Review comment:
       we can simplify this(I haven't gone through the entire patch yet). If 
you set default value for this config param to "_hoodie_is_deleted". then you 
don't need to check for isEmpty. also within OverwriteWithLatestAvroPayload, 
you could just take in the deleteKeyField as is. either it will point to 
"_hoodie_is_deleted" is not set. Else it will point to the one user has 
over-written. 
   




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to