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


##########
core/src/main/java/org/apache/iceberg/view/ViewMetadata.java:
##########
@@ -479,6 +491,23 @@ public ViewMetadata build() {
           metadataLocation);
     }
 
+    private void removeIntermediateViewVersionIdChanges() {
+      List<MetadataUpdate.SetCurrentViewVersion> setCurrentViewVersions =
+          
changes(MetadataUpdate.SetCurrentViewVersion.class).collect(Collectors.toList());
+      // only keep the last set version id
+      if (setCurrentViewVersions.size() > 1) {
+        MetadataUpdate.SetCurrentViewVersion lastSetViewVersionId =
+            setCurrentViewVersions.get(setCurrentViewVersions.size() - 1);
+        // this can't compare SetCurrentViewVersion.version() with 
currentVersionId as
+        // SetCurrentViewVersion.version() can be -1 (to indicate that the 
versionId can be
+        // re-assigned on the server)
+        changes.removeIf(
+            c ->
+                (c instanceof MetadataUpdate.SetCurrentViewVersion)
+                    && !c.equals(lastSetViewVersionId));
+      }
+    }
+

Review Comment:
   ```suggestion
   ```



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