shaoyu-li commented on code in PR #13058:
URL: https://github.com/apache/gravitino/pull/13058#discussion_r3985436349


##########
catalogs/catalog-lakehouse-generic/src/main/java/org/apache/gravitino/catalog/lakehouse/generic/GenericCatalogOperations.java:
##########
@@ -192,9 +207,11 @@ public boolean dropSchema(NameIdentifier ident, boolean 
cascade) throws NonEmpty
           "Schema %s is not empty, cannot drop it without cascade", ident);
     }
 
-    // Drop all tables under the schema first if cascade is true.
+    // Drop all tables under the schema first if cascade is true. This goes 
through the catalog
+    // level dropTable, so that the location of each table is unprovisioned 
and its cached format
+    // invalidated.
     for (NameIdentifier tableIdent : tableIdents) {
-      tableOps(tableIdent).dropTable(tableIdent);
+      dropTable(tableIdent);

Review Comment:
   Agreed it's worth fixing, with a caveat on how far it can go. `name()` is an 
instance method, so
   selection has to instantiate every candidate at least once to learn its name 
— caching moves that
   from once per catalog to once per classloader, it doesn't remove it. And
   `LakehouseTableDelegatorFactory` caches *instances*, which this SPI can't: 
providers are one per
   catalog, each with its own `initialize()`. So: cache name-to-Class once, 
reflectively instantiate
   only the selected provider per catalog, surface duplicate names at 
discovery. The javadoc will say
   plainly what that does and does not buy.
   
   Separately, the lookup now survives a provider whose constructor or `name()` 
throws — a broken jar
   fails with `NoClassDefFoundError`, which isn't a `RuntimeException`, and one 
bad jar shouldn't stop
   every catalog from starting.



##########
catalogs/catalog-lakehouse-generic/src/main/java/org/apache/gravitino/catalog/lakehouse/generic/GenericCatalogOperations.java:
##########
@@ -192,9 +207,11 @@ public boolean dropSchema(NameIdentifier ident, boolean 
cascade) throws NonEmpty
           "Schema %s is not empty, cannot drop it without cascade", ident);
     }
 
-    // Drop all tables under the schema first if cascade is true.
+    // Drop all tables under the schema first if cascade is true. This goes 
through the catalog
+    // level dropTable, so that the location of each table is unprovisioned 
and its cached format
+    // invalidated.
     for (NameIdentifier tableIdent : tableIdents) {
-      tableOps(tableIdent).dropTable(tableIdent);
+      dropTable(tableIdent);

Review Comment:
   Agreed it's worth fixing, with a caveat on how far it can go. `name()` is an 
instance method, so
   selection has to instantiate every candidate at least once to learn its name 
— caching moves that
   from once per catalog to once per classloader, it doesn't remove it. And
   `LakehouseTableDelegatorFactory` caches *instances*, which this SPI can't: 
providers are one per
   catalog, each with its own `initialize()`. So: cache name-to-Class once, 
reflectively instantiate
   only the selected provider per catalog, surface duplicate names at 
discovery. The javadoc will say
   plainly what that does and does not buy.
   
   Separately, the lookup now survives a provider whose constructor or `name()` 
throws — a broken jar
   fails with `NoClassDefFoundError`, which isn't a `RuntimeException`, and one 
bad jar shouldn't stop
   every catalog from starting.



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