bowenli86 commented on a change in pull request #9908: [FLINK-14401][table][hive] create FunctionDefinitionUtil to instantiate regular java class-based udf and add HiveFunctionDefinitionFactory to instantiate both flink and hive udf URL: https://github.com/apache/flink/pull/9908#discussion_r336260981
########## File path: flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java ########## @@ -242,21 +242,17 @@ public void registerTempCatalogScalarFunction(ObjectIdentifier oi, ScalarFunctio CatalogFunction catalogFunction = catalog.getFunction( new ObjectPath(catalogManager.getCurrentDatabase(), functionName)); - if (catalog.getTableFactory().isPresent() && - catalog.getTableFactory().get() instanceof FunctionDefinitionFactory) { - - FunctionDefinitionFactory factory = (FunctionDefinitionFactory) catalog.getTableFactory().get(); - - userCandidate = factory.createFunctionDefinition(functionName, catalogFunction); - - return Optional.of( - new FunctionLookup.Result( - ObjectIdentifier.of(catalogManager.getCurrentCatalog(), catalogManager.getCurrentDatabase(), name), - userCandidate) - ); + if (catalog.getFunctionDefinitionFactory().isPresent()) { + userCandidate = catalog.getFunctionDefinitionFactory().get().createFunctionDefinition(functionName, catalogFunction); } else { - // TODO: should go through function definition discover service + userCandidate = FunctionDefinitionUtil.createFunctionDefinition(functionName, catalogFunction); Review comment: This has nothing to do with GenericInMemoryCatalog, thus I'm not so sure what you mean. Maybe you can elaborate more? As we discussed this morning, catalog can provide its own function definition factory; if not, the function definition instantiation will go thru the default logic. Just like how table instantiation logic works. And GenericInMemoryCatalog won't provide its own function definition factory ---------------------------------------------------------------- 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