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


##########
core/src/main/java/org/apache/gravitino/catalog/ManagedFunctionOperations.java:
##########
@@ -71,29 +84,56 @@ public ManagedFunctionOperations(EntityStore store, 
IdGenerator idGenerator) {
 
   @Override
   public NameIdentifier[] listFunctions(Namespace namespace) throws 
NoSuchSchemaException {
-    // TODO: Implement when FunctionEntity is available
-    throw new UnsupportedOperationException("listFunctions: FunctionEntity not 
yet implemented");
+    return Arrays.stream(listFunctionInfos(namespace))
+        .map(f -> NameIdentifier.of(namespace, f.name()))
+        .toArray(NameIdentifier[]::new);
   }
 
   @Override
   public Function[] listFunctionInfos(Namespace namespace) throws 
NoSuchSchemaException {
-    // TODO: Implement when FunctionEntity is available
-    throw new UnsupportedOperationException(
-        "listFunctionInfos: FunctionEntity not yet implemented");
+    try {
+      List<FunctionEntity> functions =
+          store.list(namespace, FunctionEntity.class, 
Entity.EntityType.FUNCTION);
+      return functions.toArray(FunctionEntity[]::new);
+
+    } catch (NoSuchEntityException e) {
+      throw new NoSuchSchemaException(e, "Schema %s does not exist", 
namespace);
+    } catch (IOException e) {
+      throw new RuntimeException("Failed to list functions in namespace " + 
namespace, e);
+    }
   }
 
   @Override
   public Function getFunction(NameIdentifier ident) throws 
NoSuchFunctionException {
-    // TODO: Implement when FunctionEntity is available
-    throw new UnsupportedOperationException("getFunction: FunctionEntity not 
yet implemented");
+    return getFunction(ident, FunctionEntity.LATEST_VERSION);
   }
 
   @Override
   public Function getFunction(NameIdentifier ident, int version)

Review Comment:
   How do user know which versions they already have and which version to pick? 
Since you don't have a list version interface.



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