DESCRIBE FUNCTION
Returns the metadata about an existing user-defined function (UDF) in the catalog.
Syntax{ DESC | DESCRIBE } FUNCTION <function_name>
To run DESCRIBE FUNCTION, users need the USAGE privilege on the catalog and SELECT privilege on the UDF.
Parameters
<function_name> String
The name of an existing UDF.
Examples
Display the metadata for a scalar functionCREATE FUNCTION hello() RETURNS VARCHAR RETURN 'Hello World!';
DESCRIBE FUNCTION hello
-- Name: hello
-- Input: ()
-- Returns: VARCHAR
-- Owner: gnarly@example.com
-- Created At: Wed May 11 17:20:35 EDT 2022
-- Modified At: Wed May 11 17:20:35 EDT 2022
-- Body: 'Hello World!'
CREATE FUNCTION area (x DOUBLE, y DOUBLE) RETURNS DOUBLE RETURN x * y;
DESCRIBE FUNCTION area
-- Name: area
-- Type: SCALAR
-- Input: x DOUBLE
y DOUBLE
-- Returns: DOUBLE
-- Owner: gnarly@example.com
-- Created At: Mon Apr 25 19:31:28 EDT 2022
-- Modified At: Mon May 09 09:01:57 EDT 2022
-- Body: x * y
CREATE FUNCTION find_fruit (name VARCHAR, color VARCHAR)
RETURNS TABLE (name VARCHAR, color VARCHAR)
RETURN SELECT * FROM <catalog-name>.t WHERE <catalog-name>.t.name = find_fruit.name
AND <catalog-name>.t.color = find_fruit.color;
DESCRIBE FUNCTION find_fruit
-- Name: find_fruit
-- Input: "name": "color", "type": "varchar"
-- Returns: struct<name::varchar>
-- Owner: gnarly@example.com
-- Created At: Mon Apr 25 19:31:28 EDT 2022
-- Modified At: Mon May 09 09:01:57 EDT 2022
-- Body: SELECT "name"\nFROM "<catalog-name>"."t10"\nWHERE ("<catalog-name>"."t"."color" = "color")
Columns
| Column | Data Type | Description |
|---|---|---|
| Name | varchar | The name of the function. |
| Input | varchar | The parameters of the function with one tuple per line: parameter_name data_type. |
| Returns | varchar | The return type of the function. For a scalar function, show <data_type>. For a tabular function, show TABLE ( <column_name> [, ...] ). |
| Body | varchar | The body of the function, namely, expression or query from the CREATE FUNCTION … RETURN clause. |
| Created_At | timestamp | The timestamp of when the function was created. |
| Last_Modified_At | timestamp | The timestamp of when the function was last modified. |
| Owner | varchar | The current owner of the function. |