MaxCompute offers a variety of built-in functions to meet your computing requirements. You can also use user-defined functions (UDFs).
In the broad sense, UDFs include user-defined scalar functions (UDFs), user-defined aggregation functions (UDAFs), and user-defined table-valued functions (UDTFs). In the narrow sense, UDFs refer only to user-defined scalar functions. The term UDF is frequently used in Alibaba Cloud documentation. You can determine whether it is used in the narrow sense based on the context.
select ::Function name (expression) ;statement. For example, if a CONCAT UDF and a CONCAT built-in function are available in MaxCompute, MaxCompute calls the UDF rather than the built-in function. To call the CONCAT built-in function, execute the
select ::concat('ab', 'c') ;statement.
|UDF||User-defined scalar function. The relationship between the input and output of a user-defined scalar function is one-to-one mapping. One value is returned each time a user-defined scalar function reads one row of data.|
|UDTF||A user-defined table-valued function. It is used in scenarios where multiple rows of data are returned after you call each function. Only this type of function can return multiple fields. A UDTF is not equivalent to a user-defined type (UDT).|
|UDAF||A user-defined aggregation function. The relationship between the input and output of a user-defined aggregation function is many-to-one mapping. Multiple input records are aggregated to generate one output value. It can be used with the GROUP BY clause of SQL. For more information, see Aggregate functions.|
set odps.sql.udf.joiner.jvm.memory=xxxx;statement to adjust the memory size.
MaxCompute UDFs can be shared by multiple projects. UDFs in one project can be used in another project. The SQL statement for cross-project UDF sharing is
select other_project:udf_in_other_project(arg0, arg1) as res from table_t;. For more information, see Authorize users.