Skip to main content

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 function
CREATE 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!'
Display the metadata for a scalar function
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
Display the metadata for a tabular function
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

ColumnData TypeDescription
NamevarcharThe name of the function.
InputvarcharThe parameters of the function with one tuple per line: parameter_name data_type.
ReturnsvarcharThe return type of the function. For a scalar function, show <data_type>. For a tabular function, show TABLE ( <column_name> [, ...] ).
BodyvarcharThe body of the function, namely, expression or query from the CREATE FUNCTION … RETURN clause.
Created_AttimestampThe timestamp of when the function was created.
Last_Modified_AttimestampThe timestamp of when the function was last modified.
OwnervarcharThe current owner of the function.