mkroll-db commented on code in PR #18203:
URL: https://github.com/apache/iceberg/pull/18203#discussion_r4092329478


##########
core/src/main/java/org/apache/iceberg/rest/ResourcePaths.java:
##########
@@ -108,6 +110,17 @@ public String register(Namespace ns) {
     return SLASH.join("v1", prefix, "namespaces", pathEncode(ns), "register");
   }
 
+  public String unregister(TableIdentifier ident) {
+    return SLASH.join(
+        "v1",
+        prefix,
+        "namespaces",
+        pathEncode(ident.namespace()),
+        "tables",
+        RESTUtil.encodeString(ident.name()),

Review Comment:
   Fixed in a86231e6bf40885fe42fd1b99ca563464544f848



##########
api/src/main/java/org/apache/iceberg/Table.java:
##########
@@ -335,6 +335,16 @@ default UpdatePartitionStatistics 
updatePartitionStatistics() {
   /** Returns a {@link FileIO} to read and write table data and metadata 
files. */
   FileIO io();
 
+  /**
+   * Returns the location of the current table metadata file.
+   *
+   * @return the current table metadata file location
+   */
+  default String metadataFileLocation() {

Review Comment:
   Yes. This is a better approach. Fixed in 
a86231e6bf40885fe42fd1b99ca563464544f848



##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -805,6 +807,40 @@ public Table registerTable(
         response.labels());
   }
 
+  /**
+   * 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 table 
is fixed at the last
+   * metadata registered with the catalog.
+   *
+   * @param context session context
+   * @param identifier a table identifier
+   * @return a read-only table fixed at the metadata current when it was 
unregistered
+   */
+  @Override
+  public Table 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());
+      StaticTableOperations ops = new 
StaticTableOperations(response.metadata(), io);
+      return new BaseTable(ops, fullTableName(identifier));

Review Comment:
   Fixed in a86231e6bf40885fe42fd1b99ca563464544f848



##########
core/src/main/java/org/apache/iceberg/BaseTable.java:
##########
@@ -81,6 +81,11 @@ public TableOperations operations() {
     return ops;
   }
 
+  @Override
+  public String metadataFileLocation() {

Review Comment:
   Fixed in a86231e6bf40885fe42fd1b99ca563464544f848



##########
core/src/main/java/org/apache/iceberg/SerializableTable.java:
##########
@@ -111,6 +111,7 @@ public static Table copyOf(Table table) {
     }
   }
 
+  @Override

Review Comment:
   Fixed in a86231e6bf40885fe42fd1b99ca563464544f848



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