Docs Home
Viewing docs for
BYOCSelf-Managed

Manage User-Defined Functions (UDFs)

On this page

This document explains how to manage user-defined functions (UDFs) in a fully managed Flink. For example, you can register, update, and delete a UDF.

Precautions

To prevent conflicts between JAR package dependencies, take note of the following points when you develop UDFs:

  • Make sure that the Flink version that you select on the Draft Editor page is the same as the Flink version in the POM dependency.
  • Specify <scope>provided</scope> for Flink-related dependencies.
  • Use the Shade plug-in to package other third-party dependencies. For more information, see Apache Maven Shade plug-in.

Register a UDF

Before you can use a UDF in SQL statements, register the UDF. Only registered UDFs can be used in SQL statements.

  1. In the left navigation, click the Namespace selector and select the namespace that you want to open.
  2. Click SQL editor and choose the Drafts tab.
  3. Click on the UDFs tab on the right side menu.
Register a UDF
  1. Click Register UDF Artifact.
  2. Upload a UDF JAR file.

Upload a UDF JAR File

You can use one of the following methods to upload a UDF JAR file:

Option 1: Upload a File

  • Click Click to select next to Select a file to upload the UDF Artifact file that you want to upload.
  • If you want to upload a dependency file, click Click to select next to Dependencies to upload the file that your UDF Artifact file depends on.

Option 2: External URL

  1. Enter an external URL.
    • If the size of the UDF Artifact file or the size of the UDF Artifact dependency file is large, Ververica recommends that you upload the file by using an external URL.
    • The external URL support only accessible HTTP links. You need to make sure that the network between the Flink service and the external HTTP service is connected.
  2. Click Confirm.
  3. Select the required available functions in the Manage Functions window and click Create functions.

In the UDFs list on the left side of the SQL Editor page, you can view all the UDFs that are registered.

Register a Deployment-level UDF

To register a deployment-level UDF, perform the following steps:

  1. Upload the JAR or Python file of the UDF.
  2. In the left navigation, click Artifacts. On the Artifacts page, click Upload Artifact to upload the JAR or Python file of the UDF.
  3. Specify a deployment-level UDF in your deployment.
  4. On the Configurations tab of the SQL Editor page, select the JAR or Python file of the UDF from Additional Dependencies.
  5. Register a deployment-level UDF.
    • Java UDF
SQL
1CREATE TEMPORARY FUNCTION yourfunctionname;
  • Python UDF
SQL
1CREATE TEMPORARY FUNCTION yourfunctionname LANGUAGE Python;

Delete a UDF

  1. In the left navigation, click the Namespace selector and select the namespace that you want to open.
  2. Click SQL editor and choose the Drafts tab.
  3. Click on the UDFs tab.
  4. In the UDFs list, move the pointer over the name of the UDF JAR file that you want to delete and click the Waste bucket icon in the UDFs tab toolbar.
Was this helpful?