[GitHub] [flink] WeiZhong94 commented on a change in pull request #11884: [FLINK-17345][python][table] Support register and get Python UDF in Catalog.

2020-04-23 Thread GitBox


WeiZhong94 commented on a change in pull request #11884:
URL: https://github.com/apache/flink/pull/11884#discussion_r414255081



##
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
##
@@ -194,22 +194,32 @@ public void registerCatalogFunction(
UnresolvedIdentifier unresolvedIdentifier,
Class functionClass,
boolean ignoreIfExists) {
-   final ObjectIdentifier identifier = 
catalogManager.qualifyIdentifier(unresolvedIdentifier);
-   final ObjectIdentifier normalizedIdentifier = 
FunctionIdentifier.normalizeObjectIdentifier(identifier);
 
try {
UserDefinedFunctionHelper.validateClass(functionClass);
} catch (Throwable t) {
throw new ValidationException(
String.format(
"Could not register catalog function 
'%s' due to implementation errors.",
-   identifier.asSummaryString()),
+   
catalogManager.qualifyIdentifier(unresolvedIdentifier).asSummaryString()),
t);
}
 
-   final Catalog catalog = 
catalogManager.getCatalog(normalizedIdentifier.getCatalogName())
-   .orElseThrow(IllegalStateException::new);
-   final ObjectPath path = identifier.toObjectPath();
+   final CatalogFunction catalogFunction = new CatalogFunctionImpl(

Review comment:
   The initial reason of this change is provide an approach in 
`FunctionCatalog` to register Python CatalogFunction. But it seems not 
necessary now because the upper layer accesses the Catalog object directly.





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




[GitHub] [flink] WeiZhong94 commented on a change in pull request #11884: [FLINK-17345][python][table] Support register and get Python UDF in Catalog.

2020-04-23 Thread GitBox


WeiZhong94 commented on a change in pull request #11884:
URL: https://github.com/apache/flink/pull/11884#discussion_r414254201



##
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogFunctionImpl.java
##
@@ -67,6 +67,9 @@ public CatalogFunction copy() {
 
@Override
public boolean isGeneric() {
+   if (functionLanguage == FunctionLanguage.PYTHON) {

Review comment:
   Currently the Python UDF is always generic and can not be loaded via 
`Class.forName`. So just return true if the CatalogFunction is a Python UDF.





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