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


##########
core/src/main/java/org/apache/gravitino/storage/relational/service/FilesetMetaService.java:
##########
@@ -314,26 +314,10 @@ public int deleteFilesetVersionsByRetentionCount(Long 
versionRetentionCount, int
 
   private void fillFilesetPOBuilderParentEntityId(FilesetPO.Builder builder, 
Namespace namespace) {
     NamespaceUtil.checkFileset(namespace);
-    Long parentEntityId = null;
-    for (int level = 0; level < namespace.levels().length; level++) {
-      String name = namespace.level(level);
-      switch (level) {
-        case 0:
-          parentEntityId = 
MetalakeMetaService.getInstance().getMetalakeIdByName(name);
-          builder.withMetalakeId(parentEntityId);
-          continue;
-        case 1:
-          parentEntityId =
-              CatalogMetaService.getInstance()
-                  .getCatalogIdByMetalakeIdAndName(parentEntityId, name);
-          builder.withCatalogId(parentEntityId);
-          continue;
-        case 2:
-          parentEntityId =
-              
SchemaMetaService.getInstance().getSchemaIdByCatalogIdAndName(parentEntityId, 
name);
-          builder.withSchemaId(parentEntityId);
-          break;
-      }
-    }
+    Long[] parentEntityIds =
+        
CommonMetaService.getInstance().getParentEntityIdsByNamespace(namespace);
+    builder.withMetalakeId(parentEntityIds[0]);
+    builder.withCatalogId(parentEntityIds[1]);
+    builder.withSchemaId(parentEntityIds[2]);

Review Comment:
   Maybe we can change to this style for here and below.
   
   ```java
       builder.withMetalakeId(parentEntityIds[0])
             .withCatalogId(parentEntityIds[1]);
             .withSchemaId(parentEntityIds[2]);
   ```



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