bowenli86 commented on a change in pull request #8920: [FLINK-13024][table] 
integrate FunctionCatalog with CatalogManager
URL: https://github.com/apache/flink/pull/8920#discussion_r300807011
 
 

 ##########
 File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
 ##########
 @@ -116,15 +119,48 @@ public void registerScalarFunction(String name, 
ScalarFunction function) {
        }
 
        public String[] getUserDefinedFunctions() {
-               return userFunctions.values().stream()
-                       .map(FunctionDefinition::toString)
-                       .toArray(String[]::new);
+               List<String> result = new ArrayList<>();
+
+               // Get functions in catalog
+               Catalog catalog = 
catalogManager.getCatalog(catalogManager.getCurrentCatalog()).get();
+               try {
+                       
result.addAll(catalog.listFunctions(catalogManager.getCurrentDatabase()));
+               } catch (DatabaseNotExistException e) {
+                       // Ignore since there will always be a current database 
of the current catalog
+               }
+
+               // Get built-in functions
+               result.addAll(
+                       BuiltInFunctionDefinitions.getDefinitions()
+                               .stream()
+                               .map(f -> f.getName())
+                               .collect(Collectors.toList()));
+
 
 Review comment:
   I agree. That can be on its own PR

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to