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


##########
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:
   I don't think we can just change a public method as that will break API 
compatibility: 
https://github.com/apache/iceberg/blob/master/CONTRIBUTING.md#semantic-versioning
   
   @sandflee what's the expectation on your end for this PR? Are you expecting 
a backing catalog (such as JDBC) to also return either a single snapshot vs all 
snapshots when the `snapshot-loading-mode` is set?



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