nastra commented on code in PR #12821:
URL: https://github.com/apache/iceberg/pull/12821#discussion_r2048979305


##########
core/src/main/java/org/apache/iceberg/view/ViewMetadata.java:
##########
@@ -249,9 +249,23 @@ public Builder setCurrentVersionId(int newVersionId) {
         changes.add(new MetadataUpdate.SetCurrentViewVersion(newVersionId));
       }
 
+      // Use the timestamp from the view version if it was added in current 
set of changes;

Review Comment:
   I would slightly update/simplify this to 
   ```
          // Use the timestamp from the view version if it was added in current 
set of changes;
          // otherwise, use the current system time. This handles cases where 
the view version
   -      // was created in a past commit and is being re-activated.
   +      // was set as current in the past and is being re-activated.
          boolean versionAddedInThisChange =
   -          changes.stream()
   -              .anyMatch(
   -                  change ->
   -                      change instanceof MetadataUpdate.AddViewVersion
   -                          && ((MetadataUpdate.AddViewVersion) 
change).viewVersion().versionId()
   -                              == newVersionId);
   -
   -      long timestamp =
   -          versionAddedInThisChange ? version.timestampMillis() : 
System.currentTimeMillis();
   +          changes(MetadataUpdate.AddViewVersion.class)
   +              .anyMatch(added -> added.viewVersion().versionId() == 
newVersionId);
   
          this.historyEntry =
              ImmutableViewHistoryEntry.builder()
   -              .timestampMillis(timestamp)
   +              .timestampMillis(
   +                  versionAddedInThisChange ? version.timestampMillis() : 
System.currentTimeMillis())
                  .versionId(version.versionId())
                  .build();
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to