anilkumgopalap commented on code in PR #14862:
URL: https://github.com/apache/gravitino/pull/14862#discussion_r4643387417
##########
catalogs/catalog-lakehouse-generic/src/main/java/org/apache/gravitino/catalog/lakehouse/generic/GenericCatalogOperations.java:
##########
@@ -218,19 +275,40 @@ public boolean dropSchema(NameIdentifier ident, boolean
cascade) throws NonEmpty
"Schema %s is not empty, cannot drop it without cascade", ident);
}
+ TableLocationProvider provider = tableLocationProvider;
+ boolean schemaHooks = provider instanceof SupportsSchemaLocations;
+ Schema schema = null;
+ if (schemaHooks || tableIdents.length > 0) {
+ try {
+ schema = loadSchema(ident);
+ } catch (NoSuchSchemaException e) {
+ return false;
+ }
+ }
+
// Drop all tables under the schema first if cascade is true. This goes
through the same path
// as the catalog level dropTable, so that the location of each table is
unprovisioned and its
// cached format invalidated. The schema is resolved once for the whole
cascade rather than
// once per table: every table here has the same parent, and the provider
may not ask for it at
// all.
- if (tableIdents.length > 0) {
- Schema cascadedSchema = loadSchema(ident);
- for (NameIdentifier tableIdent : tableIdents) {
- dropOrPurgeTable(tableIdent, false /* purge */, cascadedSchema);
- }
+ List<NameIdentifier> tablesWithRetainedData = Lists.newArrayList();
+ for (NameIdentifier tableIdent : tableIdents) {
+ dropOrPurgeTable(tableIdent, false /* purge */, schema,
tablesWithRetainedData);
}
- return schemaOps.dropSchema(ident, cascade);
+ boolean dropped = schemaOps.dropSchema(ident, cascade);
+ if (dropped && schemaHooks) {
+ unprovisionSchemaLocation(
Review Comment:
Thanks! I'll keep table unprovision as is in this PR and open a follow-up
issue for the format-level pre-check.
--
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]