Skip to content

UserFunctionLoader

UserFunctionLoader uses Function Loaders to loadFunctions.

Creating Instance

UserFunctionLoader takes the following to be created:

  • MutableFunctionRegistry
  • Plugin Directory
  • Parent ClassLoader
  • blacklist
  • Metrics
  • loadCustomerUdfs flag

UserFunctionLoader is created when:

  • UdfLoaderUtil is requested to load
  • UserFunctionLoader is requested to newInstance

Function Loaders

UserFunctionLoader creates the function loaders when created:

The loaders are used to loadFunctions.

Creating UserFunctionLoader

UserFunctionLoader newInstance(
  KsqlConfig config,
  MutableFunctionRegistry metaStore,
  String ksqlInstallDir,
  Metrics metricsRegistry)

With ksql.udf.enable.security.manager enabled, newInstance sets the System security as ExtensionSecurityManager.

In the end, newInstance creates a UserFunctionLoader with the following:


newInstance is used when:

Loading Function Jars

void load()

load loadFunctions.

With loadCustomerUdfs enabled, load finds all the jar files in the pluginDir and loadFunctions for every jar file (unless blacklisted).


load is used when:

loadFunctions

void loadFunctions(
  ClassLoader loader,
  Optional<Path> path)

ClassGraph

loadFunctions uses ClassGraph library to scan the classpath.

loadFunctions finds classes with the function annotations and uses the UdfLoader to load them.

Annotation Loader
UdfDescription UdfLoader
UdafDescription UdafLoader
UdtfDescription UdtfLoader

Logging

Enable ALL logging level for io.confluent.ksql.function.UserFunctionLoader logger to see what happens inside.

Add the following line to config/log4j.properties:

log4j.logger.io.confluent.ksql.function.UserFunctionLoader=ALL

Refer to Logging.