jerryshao commented on code in PR #8420:
URL: https://github.com/apache/gravitino/pull/8420#discussion_r2320943230
##########
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:
In the real case, one audit info is from the underlying sources, another is
stored in Gravitino, if the underlying one is empty/null, we will overwrite
with the one stored in Gravitino. If the underlying one is not null / empty, we
will always use the underlying one.
Besides, the one stored in Gravitino will always have the necessary fields,
so it will not meet the case all the fields are 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]