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


##########
core/src/main/java/org/apache/iceberg/view/ViewMetadata.java:
##########
@@ -249,9 +249,17 @@ 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.
+      // Otherwise, use the current system time. This handles cases where the 
view version
+      // was set as current in the past and is being re-activated.
+      boolean versionAddedInThisChange =
+          changes(MetadataUpdate.AddViewVersion.class)
+              .anyMatch(added -> added.viewVersion().versionId() == 
newVersionId);
+
       this.historyEntry =
           ImmutableViewHistoryEntry.builder()
-              .timestampMillis(version.timestampMillis())
+              .timestampMillis(

Review Comment:
   If the version was added in the current request to change 
current-version-id, then it should use the timestamp from the version so it all 
matches. With timestamps there is no "correct" -- we want to have predictable 
and reasonable behavior. Making the timestamps match makes sense so that you 
don't have to reason about things that were "probably" part of the same change.



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