Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If the user uses CREATA FUNCTION ... USING JAR statement to register the UDF, the general process is as follows:

...

very simple, we only create the UDF in catalog by class name and store the path information of UDF resources.

...

we neither check for resource available nor validity of the class exists because of `CREATE FUNCTION` are pure metadata catalog operations in Flink.

UDF Usage

...

Process

If the user uses a UDF registered by CREATA FUNCTION ... USING JAR statement in query, the general process is as follows:

  1. Parsing the SQL to find the UDF used in the query, if it is found that the UDF is registered with the Jar resource, first determine whether the Jar resource has been registered.
  2. If the Jar is not registered before, determine whether the Jar resource path is in the remote. If in the remote, will first download the Jar resource to the local temporary directory which will be generated using UUID.
  3. Then the local path will be registered into the user class loader and loaded the class into JVM for calcite validation and code generation.
  4. Finally, when the job is submitted, the Jar resource is uploaded to the blobstore at the same time, so that it is available at distributed runtime.

...

Comprehensive consideration of the above, based on FLINK-15635, in this FLIP, the overall code design is as follows:

  1. Proposing an internal interface UserClassLoaderContext, this interface encapsulates the user class loader and the user's registered Jar resource. The user class loader contains all the registered Jar resources. entity performs bookkeeping of used/loaded resources. This entity should also provide a UserClassLoader that inherits from the class loader given via EnvironmentSettings. UserClassLoaderContext is responsible for resource manager
  2. The table environment directly refers UserClassLoaderContext instead of ClassLoader object, to ensure that when the ClassLoader object changes, the latest available ClassLoader can be obtained.
  3. The objects which need use the custom ClassLoader such as DataTypeFactoryImpl currently hold UserClassLoaderContext directly in entire table module, instead of holding ClassLoader before.

...

  1. .

Migration Plan and Compatibility

...