This topic describes the classification and definition of user-defined extensions (UDXs) and how to pass UDX parameters in the console of fully managed Flink.

UDX types

The following table describes the three types of UDXs that are supported by Flink.
UDX type Description
User-defined scalar function (UDF) A UDF maps zero, one, or more scalar values to a new scalar value. A one-to-one mapping is established between the input and output of a UDF. Each time a UDF reads one row of data, it writes an output value. For more information, see UDFs.
User-defined aggregate function (UDAF) A UDAF aggregates multiple records into a single value. A many-to-one mapping is established between the input and output of a UDAF. Multiple input records are aggregated to generate one output value. For more information, see UDAFs.
User-defined table-valued function (UDTF) A UDTF takes zero, one, or more scalar values as input parameters. These parameters can be variable-length parameters. UDTFs are similar to UDFs but differ in that UDTFs return any number of rows instead of a single value. Returned rows consist of one or more columns. Multiple rows or columns are returned each time a UDTF is called. For more information, see UDTFs.

Pass UDX parameters

If you want to modify a parameter of a UDX, we recommend that you do not modify the parameter in UDX code because the process is complex. In this case, you can configure this parameter in the Additional Configuration section of the Advanced tab in the console of fully managed Flink and then use this parameter in UDX code. This way, you can directly change the parameter value in the console of fully managed Flink.

UDXs support the open(FunctionContext context) method, which is optional. You can use FunctionContext to pass custom configuration items. To pass UDX parameters, perform the following steps:
  1. On the right side of the Draft Editor page, click the Advanced tab and add the required parameters and their values to the Additional Configuration section. Sample code:
    maxJobCreationAttempts: value
  2. Use the ConfigOptions.key() method in UDX code to obtain UDX parameters. Sample code:
    public void open(FunctionContext context) throws Exception {
        LOG.info(String.format("maxJobCreationAttempts:%s%n",
        ConfigOptions.key("maxJobCreationAttempts").stringType().noDefaultValue()));
    }