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

 ##########
 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:
   I'm not sure if FunctionCatalog should make this call and it's probably 
better to let Catalog implementation do whatever needed.
   
   We probably can make this call in GenericInMororyCatalog's 
FunctionDefinitionFactory.createFunctionDefinition().
   
   What do you think?

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