flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] xuefuz commented on a change in pull request #9998: [FLINK-14534][table] FunctionCatalog.getUserDefinedFunctions() should include temp functions
Date Tue, 29 Oct 2019 18:14:01 GMT
xuefuz commented on a change in pull request #9998: [FLINK-14534][table] FunctionCatalog.getUserDefinedFunctions()
should include temp functions
URL: https://github.com/apache/flink/pull/9998#discussion_r340246136
 
 

 ##########
 File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
 ##########
 @@ -209,20 +217,25 @@ public void registerTempCatalogScalarFunction(ObjectIdentifier oi,
ScalarFunctio
 	private Set<String> getUserDefinedFunctionNames() {
 		Set<String> result = new HashSet<>();
 
-		// Get functions in catalog
+		// add temp system functions
+		result.addAll(tempSystemFunctions.keySet());
+
+		// add temp catalog functions
+		result.addAll(tempCatalogFunctions.keySet().stream()
+			.filter(oi -> oi.getCatalogName().equals(catalogManager.getCurrentCatalog())
+				&& oi.getDatabaseName().equals(catalogManager.getCurrentDatabase()))
+			.map(oi -> oi.getObjectName())
+			.collect(Collectors.toSet())
+		);
+
+		// add catalog functions
 		Catalog catalog = catalogManager.getCatalog(catalogManager.getCurrentCatalog()).get();
 		try {
 			result.addAll(catalog.listFunctions(catalogManager.getCurrentDatabase()));
 
 Review comment:
   Nit: it might be cleaner to have a local var for current cat/db so as to avoid catalogManager.getXXX().

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message