You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "danielcweeks (via GitHub)" <gi...@apache.org> on 2026/07/06 22:35:09 UTC

Re: [PR] Core: Add unregister table to RCK [iceberg]

danielcweeks commented on code in PR #16584:
URL: https://github.com/apache/iceberg/pull/16584#discussion_r3532446965


##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -731,6 +732,38 @@ public Table registerTable(
         ops, fullTableName(ident), metricsReporter(paths.metrics(ident), tableClient));
   }
 
+  /**
+   * Unregister a table from the catalog without removing its data or metadata files.
+   *
+   * <p>This is the opposite of {@link #registerTable(SessionContext, TableIdentifier, String)}. On
+   * success, the table no longer exists in the catalog and the returned metadata location can be
+   * used to register the table in another catalog.
+   *
+   * @param context session context
+   * @param identifier a table identifier
+   * @return the last metadata location for the unregistered table
+   */
+  public String unregisterTable(SessionContext context, TableIdentifier identifier) {
+    Endpoint.check(endpoints, Endpoint.V1_UNREGISTER_TABLE);
+    checkIdentifierIsValid(identifier);
+
+    try {
+      AuthSession contextualSession = authManager.contextualSession(context, catalogAuth);
+      UnregisterTableResponse response =
+          client
+              .withAuthSession(contextualSession)
+              .post(
+                  paths.unregister(identifier),
+                  null,
+                  UnregisterTableResponse.class,
+                  mutationHeaders,
+                  ErrorHandlers.tableErrorHandler());
+      return response.metadataLocation();

Review Comment:
   I think @mkroll-db is actually right about the use case.  It does work across different catalogs since all you need is the pointer to the latest metadata to register it in any catalog.
   
   The issue is just that we're not exposing the table metadata.  I was thinking we would want to return both in some sort of container object.



-- 
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-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org