dawidwys commented on code in PR #23427:
URL: https://github.com/apache/flink/pull/23427#discussion_r1328338429


##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java:
##########
@@ -306,17 +306,19 @@ public Set<FunctionIdentifier> getUserDefinedFunctions(
                         .collect(Collectors.toSet()));
 
         // add catalog functions
-        Catalog catalog = catalogManager.getCatalog(catalogName).get();
+        Optional<Catalog> catalogOpt = catalogManager.getCatalog(catalogName);
         try {
-            catalog.listFunctions(databaseName)
-                    .forEach(
-                            name ->
-                                    result.add(
-                                            FunctionIdentifier.of(
-                                                    ObjectIdentifier.of(
-                                                            catalogName, 
databaseName, name))));
+            if (catalogOpt.isPresent()) {

Review Comment:
   At first, I didn't use it because `listFunctions` throws a checked 
`DatabaseNotExistException`, but after your comment I thought we can refactor 
it a bit more and then it makes sense with `ifPresent`.



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