jerryshao commented on code in PR #8879:
URL: https://github.com/apache/gravitino/pull/8879#discussion_r2460116007


##########
catalogs/catalog-generic-lakehouse/src/main/java/org/apache/gravitino/catalog/lakehouse/GenericLakehouseCatalogOperations.java:
##########
@@ -171,10 +263,46 @@ public Table alterTable(NameIdentifier ident, 
TableChange... changes)
 
   @Override
   public boolean dropTable(NameIdentifier ident) {
-    throw new UnsupportedOperationException("Not implemented yet.");
+    EntityStore store = GravitinoEnv.getInstance().entityStore();
+    Namespace namespace = ident.namespace();
+    try {
+      GenericTableEntity tableEntity =
+          store.get(ident, Entity.EntityType.TABLE, GenericTableEntity.class);
+      Map<String, String> tableProperties = tableEntity.getProperties();
+      String format = tableProperties.getOrDefault("format", "lance");
+      LakehouseCatalogOperations lakehouseCatalogOperations =
+          SUPPORTED_FORMATS.compute(
+              format,
+              (k, v) ->
+                  v == null
+                      ? createLakehouseCatalogOperations(
+                          format, tableProperties, catalogInfo, 
propertiesMetadata)
+                      : v);
+      return lakehouseCatalogOperations.dropTable(ident);
+    } catch (IOException e) {
+      throw new RuntimeException("Failed to list tables under schema " + 
namespace, e);
+    }
   }
 
   private String ensureTrailingSlash(String path) {
     return path.endsWith(SLASH) ? path : path + SLASH;
   }
+
+  private LakehouseCatalogOperations createLakehouseCatalogOperations(
+      String format,
+      Map<String, String> properties,
+      CatalogInfo catalogInfo,
+      HasPropertyMetadata propertiesMetadata) {
+    LakehouseCatalogOperations operations;
+    switch (format.toLowerCase()) {
+      case "lance":

Review Comment:
   We'd better not hardcode "lance" here and above, using a constant and enum 
value is better.



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

Reply via email to