Karl-WangSK commented on a change in pull request #2056:
URL: https://github.com/apache/hudi/pull/2056#discussion_r480715969



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/common/model/OverwriteWithLatestAvroPayload.java
##########
@@ -79,8 +79,18 @@ public OverwriteWithLatestAvroPayload 
preCombine(OverwriteWithLatestAvroPayload
    * @param genericRecord instance of {@link GenericRecord} of interest.
    * @returns {@code true} if record represents a delete record. {@code false} 
otherwise.
    */
-  private boolean isDeleteRecord(GenericRecord genericRecord) {
+  public boolean isDeleteRecord(GenericRecord genericRecord) {
     Object deleteMarker = genericRecord.get("_hoodie_is_deleted");
     return (deleteMarker instanceof Boolean && (boolean) deleteMarker);
   }
+
+  /**
+   *
+   * @param value value in Insert Value
+   * @param defaultValue defaultValue of the field
+   * @return {@code true} if value equals defaultValue {@code false} otherwise.
+   */
+  public Boolean fieldJudge(Object value,Object defaultValue) {
+    return  defaultValue == null ? value == defaultValue : 
value.toString().equals(defaultValue.toString());

Review comment:
       1) `Object.equals()` is compare their memory address. 
   ```
   public boolean equals(Object obj) {
           return (this == obj);
       }
   ```
   2) value and defaultValue they are same field from same schema, so their 
data type must be the same, and have checked data type before using this 
method. so we just simply check if their values are the same using `toString()`.




----------------------------------------------------------------
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:
[email protected]


Reply via email to