The CREATE FUNCTION
command can be used to create user-defined functions (UDFs).
CREATE FUNCTION
can be used for them with different syntax.
CREATE FUNCTION
command is used to declare these UDFs. After that, you can use them in SQL queries like any built-in functions.
IF NOT EXISTS
.Parameter or clause | Description |
---|---|
function_name | The name of the UDF that you want to declare in RisingWave. |
argument_type | The data type of the input parameter(s) that the UDF expects to receive. |
RETURNS return_type | Use this if the function returns a single value (i.e., scalar). It specifies the data type of the return value from the UDF.The struct type, which can contain multiple values, is supported. But the field names must be consistent between the programming language and SQL definitions, or it will be considered a type mismatch. |
RETURNS TABLE | Use this if the function is a table-valued function (TVF). It specifies the structure of the table that the UDF returns. |
LANGUAGE | Optional. Specifies the programming language used to implement the UDF. Currently, Python, Java,Rust, and JavaScript are supported. |
AS function_name_defined_in_server | Specifies the function name defined in the UDF server. |
USING LINK ‘udf_server_address’ | Specifies the UDF server address. If you are running RisingWave in your local environment, the address is http://localhost: <port> If you are running RisingWave using Docker, the address is http://host.docker.internal: <port>/ |
CREATE FUNCTION
to declare an external UDF defined by Python or Java. For more details, see Use UDFs in Python or Use UDFs in Java.
CREATE FUNCTION
command is used to create these UDFs.
Here are some examples of embedded UDFs, along with links to specific guides on creating them with different languages.
CREATE FUNCTION
command is used to define SQL UDFs. You can read our guide on SQL UDFs for more details.
IF NOT EXISTS
.