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_r336603833
########## 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: not sure if I understand it from an end-to-end perspective, can you provide some code example? if the catalog doesn't provide a func def factory, what would planner do then? FunctionDefinitionUtil.createFunctionDefinition() serves as the default logic if users don't provide a func def factory to instantiate func def; if they want customized func def instantiation logic, they should provide a func def 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