Calls a SQL function the same way as a built-in function.
Syntax
select <function_name>(<column_name>[,...]) from <table_name>;Parameters
| Parameter | Description |
|---|---|
function_name | The name of the SQL function to call. |
column_name | The column to pass as input. The column's data type must match the data type defined in the function. |
table_name | The table to query. |
Examples
Call a function in the SELECT clause
The following example calls my_add (a function that adds 1 to each input value) on the c column of the src table.
-- Create a table and insert sample data.
create table src (c bigint, d string);
insert into table src values (1,100.1),(2,100.2),(3,100.3);
-- Call my_add on the c column.
select my_add(c) from src;Expected output:
+------------+
| _c0 |
+------------+
| 2 |
| 3 |
| 4 |
+------------+Related statements
CREATE SQL FUNCTION: Creates a permanent SQL function and stores it in the MaxCompute metadata system, making it available to all queries in the project.
FUNCTION: Creates a temporary SQL function without storing it in the metadata system.
DESC FUNCTION: Retrieves details of a user-defined function (UDF), including its name, owner, creation time, class name, and resource list.
LIST FUNCTIONS: Lists all UDFs in a MaxCompute project.
DROP FUNCTION: Deletes a UDF from a MaxCompute project.