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


##########
core/src/main/java/org/apache/iceberg/view/ViewMetadata.java:
##########
@@ -479,21 +488,21 @@ public ViewMetadata build() {
           metadataLocation);
     }
 
-    static List<ViewVersion> expireVersions(
-        Map<Integer, ViewVersion> versionsById, int numVersionsToKeep) {
-      // version ids are assigned sequentially. keep the latest versions by ID.
-      List<Integer> ids = Lists.newArrayList(versionsById.keySet());
-      ids.sort(Comparator.reverseOrder());
+    @VisibleForTesting
+    static List<ViewVersion> expireVersions(List<ViewVersion> versions, int 
numVersionsToKeep) {
+      List<ViewVersion> versionsToKeep = Lists.newArrayList(versions);
 
-      List<ViewVersion> retainedVersions = Lists.newArrayList();
-      for (int idToKeep : ids.subList(0, numVersionsToKeep)) {
-        retainedVersions.add(versionsById.get(idToKeep));

Review Comment:
   In hindsight I agree. I was mistakenly assuming that 
`version.history.num-entries` applies to `versions` and to `history`.
   
   @amogh-jahagirdar @rdblue any thoughts on renaming 
`version.history.num-entries` to `version.num-entries` to avoid such a 
confusion for any users trying to use this in the future? I can see that people 
might get confused about `history` in the naming and also assume it would apply 
to the `version-log` (which is basically what happened to me)



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