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:
| Integration | Definitions loaded by the adapter |
|---|---|
| Flink catalog | File functions with implementation class and resource metadata. |
| Spark V1 function interface | Java file functions. |
| Spark V2 function interface | Lambda functions with a single return value. |
Types of Functions Supported
Paimon's function metadata can represent three definition types:
| Type | Definition |
|---|---|
| File function | References implementation resources, such as JAR files, with language and entry-point metadata. |
| Lambda function | Stores a lambda definition and its language. |
| SQL function | Stores 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.
File Function Usage in Flink
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.