Updated on 2025-09-18 GMT+08:00

WITH ARGUMENTS Syntax

The WITH ARGUMENTS syntax enhances the capabilities of existing UDFs, primarily enabling users to configure the initial state upon UDF execution. Utilizing this feature, users can:

  • Configure runtime resources and concurrency: Specify the necessary resources (for example, memory, CPU) for UDF operation along with the count of concurrent execution instances to enhance performance and resource efficiency.
  • Set class initialization parameters: For UDFs defined within a class structure, employ the WITH ARGUMENTS syntax to pass initialization constructor arguments, thereby establishing a particular initial state during UDF instantiation.

Key usage considerations include:

  • WITH ARGUMENTS accommodates several predefined parameters. Refer to Table 1 for specifics. Ensure class initialization parameter names do not conflict with these fixed parameters, noting that parameter names are case-sensitive.
  • Only constants can be used as input parameters.
  • UDF function body defined in the class format. Users can define the __init__ and __del__ member methods of the class as needed, but they must define the process member method, which serves as the main function entry.
  • min_concurrency and max_concurrency must be set simultaneously. Successful configuration indicates that adaptive concurrency is enabled.
Table 1 UDF runtime configuration list

Parameter

Description

Default Value

concurrency

Concurrency of the UDF execution, with a value range of [1, 1024].

1

min_concurrency

Minimum concurrency of the UDF execution, with a value range of [1, 1024].

0

max_concurrency

Maximum concurrency of the UDF execution, with a value range of [1, 1024].

0

timeout

Timeout duration for the UDF execution, with a value range of [1, 3600], in seconds.

1000

dpu

Resource specifications for a single actor during UDF execution, for example, dpu=1 indicates a specification of 1U4G. The value can be a fractional between 0.33 and 1.0 or an integer between 1 and 32. Note that the system will round the input value to two decimal places.

1