justinmclean commented on code in PR #8420:
URL: https://github.com/apache/gravitino/pull/8420#discussion_r2320797557


##########
core/src/main/java/org/apache/gravitino/meta/AuditInfo.java:
##########
@@ -157,11 +157,20 @@ public AuditInfo merge(AuditInfo other, boolean 
overwrite) {
       return this;
     }
 
-    this.creator = overwrite || this.creator == null ? other.creator : creator;
-    this.createTime = overwrite || this.createTime == null ? other.createTime 
: createTime;
-    this.lastModifier = overwrite || this.lastModifier == null ? 
other.lastModifier : lastModifier;
+    this.creator =
+        (overwrite && other.creator != null) || this.creator == null ? 
other.creator : creator;
+    this.createTime =
+        (overwrite && other.createTime != null) || this.createTime == null
+            ? other.createTime
+            : createTime;
+    this.lastModifier =
+        (overwrite && other.lastModifier != null) || this.lastModifier == null
+            ? other.lastModifier
+            : lastModifier;
     this.lastModifiedTime =
-        overwrite || this.lastModifiedTime == null ? other.lastModifiedTime : 
lastModifiedTime;
+        (overwrite && other.lastModifiedTime != null) || this.lastModifiedTime 
== null
+            ? other.lastModifiedTime
+            : lastModifiedTime;

Review Comment:
   No It doesn't and I think it's needed - take a look at the unit test:
   ```
       AuditInfo original =
           AuditInfo.builder()
               .withCreator("creator")
               .withCreateTime(now)
               .withLastModifier("modifier")
               .withLastModifiedTime(now)
               .build();
       AuditInfo other = AuditInfo.builder().withLastModifier("new").build();
   
       original.merge(other, true);
       ```
   Someone would not expect all the other fields, including the creation time, 
to be set to null.



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