Skip to main content

Functions

A catalog function stores a reusable function definition and its metadata. The compute engine loads and executes the definition, so supported languages and function operations depend on the engine and catalog implementation.

Catalog and Engine Support​

The REST Catalog implements persistent function operations. The built-in Hive, JDBC, and Filesystem catalogs do not implement persistent function creation, alteration, or deletion.

The engine adapter determines which stored definitions it can load:

IntegrationDefinitions loaded by the adapter
Flink catalogFile functions with implementation class and resource metadata.
Spark V1 function interfaceJava file functions.
Spark V2 function interfaceLambda functions with a single return value.

Types of Functions Supported​

Paimon's function metadata can represent three definition types:

TypeDefinition
File functionReferences implementation resources, such as JAR files, with language and entry-point metadata.
Lambda functionStores a lambda definition and its language.
SQL functionStores a SQL definition.

The metadata model does not imply that every engine can execute every definition type. The following examples show Java file functions in Flink; see Functions in Spark for Spark usage.

Select a Paimon REST Catalog and make the implementation JAR accessible to the Flink job, then register the function in an existing database.

Create Function​

CREATE FUNCTION mydb.parse_str
AS 'com.streaming.flink.udf.StrUdf'
LANGUAGE JAVA
USING JAR 'oss://my_bucket/my_location/udf.jar';

Add further JAR resources to the USING clause when the function requires additional dependencies.

Alter Function​

Change the registered implementation class:

ALTER FUNCTION mydb.parse_str
AS 'com.streaming.flink.udf.StrUdf2'
LANGUAGE JAVA;

Drop Function​

DROP FUNCTION mydb.parse_str;

Functions in Spark​

See Spark SQL Functions for supported definitions and examples.