sandflee commented on code in PR #8519:
URL: https://github.com/apache/iceberg/pull/8519#discussion_r1325880064


##########
core/src/main/java/org/apache/iceberg/rest/CatalogHandlers.java:
##########
@@ -253,12 +254,34 @@ public static void purgeTable(Catalog catalog, 
TableIdentifier ident) {
     }
   }
 
-  public static LoadTableResponse loadTable(Catalog catalog, TableIdentifier 
ident) {
+  private static TableMetadata getTableMetaData(
+      BaseTable baseTable, RESTSessionCatalog.SnapshotMode snapshotMode) {
+    TableMetadata tableMetadata = baseTable.operations().current();
+
+    switch (snapshotMode) {
+      case ALL:
+        return tableMetadata;
+      case REFS:
+        {
+          TableMetadata refsMetaData = 
TableMetadata.buildFrom(tableMetadata).build();
+          Set<Long> referencedSnapshotIds =
+              refsMetaData.refs().values().stream()
+                  .map(SnapshotRef::snapshotId)
+                  .collect(Collectors.toSet());
+          refsMetaData.removeSnapshotsIf(s -> 
!referencedSnapshotIds.contains(s.snapshotId()));
+          return refsMetaData;
+        }
+    }
+    return tableMetadata;
+  }
+
+  public static LoadTableResponse loadTable(

Review Comment:
   ok, I'll implement it on the server,  thanks for your review @nastra 



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to