CREATE FUNCTION Statement

Confluent Cloud for Apache Flink® enables registering custom user-defined functions (UDFs) by using the CREATE FUNCTION statement. When your UDFs are registered in an Flink database, you can use them in your SQL queries.

Syntax

CREATE FUNCTION <function-name>
  AS <class-name>
  USING JAR 'confluent-artifact://<artifact-id>'
  [USING CONNECTIONS ('<connection-name>' [, ...])];

Description

Register a user defined function (UDF) in the current database.

The optional USING CONNECTIONS clause binds one or more Connection objects to the UDF, enabling external connectivity so the function can call external systems at runtime. Provide one or more connection names, separated by commas. The connection name must match the prefix that the UDF uses with FunctionContext.getJobParameter() — for example, USING CONNECTIONS ('my_external_service') for a my_external_service.endpoint parameter.

To remove a UDF from the current database, use the DROP FUNCTION statement.

To view the UDFs in the current database, use the SHOW FUNCTIONS statement.