roryqi commented on code in PR #11201:
URL: https://github.com/apache/gravitino/pull/11201#discussion_r3298117230


##########
core/src/main/java/org/apache/gravitino/storage/relational/service/SchemaMetaService.java:
##########
@@ -479,6 +489,24 @@ private List<SchemaPO> listSchemaPOs(Namespace namespace) {
         mapper -> POStorageReadRouting.listPOs(mapper, namespace, ops, 
Entity.EntityType.SCHEMA));
   }
 
+  /**
+   * Collects the schema ids that participate in a cascade delete: the target 
schema itself plus
+   * every HierarchicalSchema descendant. The {@link SchemaPO} arrives in 
logical form (e.g. {@code
+   * A:B}); {@link HierarchicalConversionPOStorageOps} translates to storage 
form before running the
+   * SQL prefix match, so this method only deals in logical names.
+   */
+  private List<Long> listSchemaIdsForCascade(SchemaPO schemaPO) {
+    List<SchemaPO> matched =
+        SessionUtils.getWithoutCommit(
+            SchemaMetaMapper.class,
+            mapper ->
+                ops.listPOsByNamePrefix(mapper, schemaPO.getCatalogId(), 
schemaPO.getSchemaName()));
+    if (matched == null || matched.isEmpty()) {
+      return Collections.singletonList(schemaPO.getSchemaId());
+    }
+    return 
matched.stream().map(SchemaPO::getSchemaId).collect(Collectors.toList());

Review Comment:
   I return the empty list.



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