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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]