mchades commented on code in PR #5521:
URL: https://github.com/apache/gravitino/pull/5521#discussion_r1836035920


##########
catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.java:
##########
@@ -581,29 +583,63 @@ public Schema alterSchema(NameIdentifier ident, 
SchemaChange... changes)
   @Override
   public boolean dropSchema(NameIdentifier ident, boolean cascade) throws 
NonEmptySchemaException {
     try {
+      Namespace filesetNs =
+          Namespace.of(
+              Stream.concat(Stream.of(ident.namespace().levels()), 
Stream.of(ident.name()))
+                  .toArray(String[]::new));
+      List<FilesetEntity> filesets =
+          store.list(filesetNs, FilesetEntity.class, 
Entity.EntityType.FILESET);

Review Comment:
   should catch `NoSuchEntityException` and convert to `NoSuchSchemaException`?



##########
catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.java:
##########
@@ -581,29 +583,63 @@ public Schema alterSchema(NameIdentifier ident, 
SchemaChange... changes)
   @Override
   public boolean dropSchema(NameIdentifier ident, boolean cascade) throws 
NonEmptySchemaException {
     try {
+      Namespace filesetNs =
+          Namespace.of(
+              Stream.concat(Stream.of(ident.namespace().levels()), 
Stream.of(ident.name()))
+                  .toArray(String[]::new));
+      List<FilesetEntity> filesets =
+          store.list(filesetNs, FilesetEntity.class, 
Entity.EntityType.FILESET);
+      if (filesets.size() > 0 && !cascade) {

Review Comment:
   `filesets.size() > 0` can be replaced with `!filesets.isEmpty()`



##########
catalogs/catalog-hadoop/src/main/java/org/apache/gravitino/catalog/hadoop/HadoopCatalogOperations.java:
##########
@@ -581,29 +583,63 @@ public Schema alterSchema(NameIdentifier ident, 
SchemaChange... changes)
   @Override
   public boolean dropSchema(NameIdentifier ident, boolean cascade) throws 
NonEmptySchemaException {
     try {
+      Namespace filesetNs =
+          Namespace.of(
+              Stream.concat(Stream.of(ident.namespace().levels()), 
Stream.of(ident.name()))
+                  .toArray(String[]::new));

Review Comment:
   I saw the simple usage in other places is:
   ```java
   NamespaceUtil.ofFileset(
       ident.namespace().level(0),
       ident.namespace().level(1),
       ident.name())
   ``` 



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