You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/07/11 02:19:32 UTC

[GitHub] [flink] luoyuxia commented on a diff in pull request #20001: [FLINK-27659][table] Planner support to use jar which is registered by 'CREATE FUNTION USING JAR' syntax

luoyuxia commented on code in PR #20001:
URL: https://github.com/apache/flink/pull/20001#discussion_r917495970


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/factories/FunctionDefinitionFactory.java:
##########
@@ -34,4 +35,29 @@ public interface FunctionDefinitionFactory {
      * @return a {@link FunctionDefinition}
      */
     FunctionDefinition createFunctionDefinition(String name, CatalogFunction catalogFunction);
+
+    /**
+     * Creates a {@link FunctionDefinition} from given {@link CatalogFunction}. If the {@link
+     * CatalogFunction} is created by user defined resource, the user of {@link
+     * FunctionDefinitionFactory} needs to override this method explicitly. The implementation logic
+     * needs to use the user classloader to load custom classes instead of the thread context
+     * classloader.
+     *
+     * @param name name of the {@link CatalogFunction}
+     * @param catalogFunction the catalog function
+     * @param userClassLoader the class loader is used to load user defined function's class
+     * @return a {@link FunctionDefinition}
+     */
+    default FunctionDefinition createFunctionDefinition(
+            String name, CatalogFunction catalogFunction, ClassLoader userClassLoader) {

Review Comment:
   Intead of providing ClassLoader directly, how about providing a `Context` which contains `ClassLoader` just like `ModuleFactory` `DynamicTableFactory` does?
   So that, if we need other info for this method in the future, we won't need to modify function signature.



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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org