eric-maynard commented on code in PR #1368:
URL: https://github.com/apache/polaris/pull/1368#discussion_r2043195402


##########
plugins/spark/v3.5/src/main/java/org/apache/polaris/spark/PolarisRESTCatalog.java:
##########
@@ -138,12 +152,51 @@ public void close() throws IOException {
 
   @Override
   public List<TableIdentifier> listGenericTables(Namespace ns) {
-    throw new UnsupportedOperationException("listTables not supported");
+    if (!endpoints.contains(PolarisEndpoints.V1_LIST_GENERIC_TABLES)) {
+      return ImmutableList.of();
+    }
+
+    Map<String, String> queryParams = Maps.newHashMap();
+    ImmutableList.Builder<TableIdentifier> tables = ImmutableList.builder();
+    String pageToken = "";
+    if (pageSize != null) {
+      queryParams.put("pageSize", String.valueOf(pageSize));
+    }
+
+    do {
+      queryParams.put("pageToken", pageToken);
+      ListTablesResponse response =
+          restClient
+              .withAuthSession(this.catalogAuth)
+              .get(
+                  pathGenerator.genericTables(ns),
+                  queryParams,
+                  ListTablesResponse.class,
+                  Map.of(),
+                  ErrorHandlers.namespaceErrorHandler());
+      pageToken = response.nextPageToken();
+      tables.addAll(response.identifiers());
+    } while (pageToken != null);
+
+    return tables.build();
   }
 
   @Override
   public boolean dropGenericTable(TableIdentifier identifier) {
-    throw new UnsupportedOperationException("dropTable not supported");
+    Endpoint.check(endpoints, PolarisEndpoints.V1_DELETE_GENERIC_TABLE);
+
+    try {
+      restClient
+          .withAuthSession(this.catalogAuth)
+          .delete(
+              pathGenerator.genericTable(identifier),
+              null,
+              Map.of(),
+              ErrorHandlers.tableErrorHandler());
+      return true;
+    } catch (NoSuchTableException e) {
+      return false;

Review Comment:
   How does this look in the tests? I wonder if it's better to actually throw 
the exception up to Spark here. What does Iceberg do?



-- 
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-unsubscr...@polaris.apache.org

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

Reply via email to