sandflee commented on code in PR #8519:
URL: https://github.com/apache/iceberg/pull/8519#discussion_r1324538426
##########
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:
@nastra , is it necessary to process `snapshot mode` in `CatalogHandlers` ?
if yes, maybe we could add another interface.
--
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]