Updated on 2026-11-06 GMT+08:00

DESCRIBE FUNCTION

Function

The DESCRIBE FUNCTION statement is used to view metadata information about a function, including the function name, implementation class, and usage description. If the EXTENDED option is specified, extended usage information and examples are also displayed.

Syntax

{ DESC | DESCRIBE } FUNCTION [ EXTENDED ] function_name

Parameters

Parameter

Description

EXTENDED

Optional. Displays extended information about the function, including usage methods and examples.

function_name

The function name. Can be a built-in function or a custom function. Can be qualified using database_name.function_name. If the database name is not specified, the current database is used.

Precautions

  • When EXTENDED is not used, only the function name, implementation class, and basic usage are displayed.
  • When EXTENDED is used, examples and detailed usage instructions are additionally displayed.
  • If the function does not exist, an error is reported.
  • DESC is an abbreviation of DESCRIBE.

Examples

  • Viewing a built-in scalar function
    DESC FUNCTION abs;
    -- +-------------------------------------------------------------------+
    -- |function_desc                                                      |
    -- +-------------------------------------------------------------------+
    -- |Function: abs                                                      |
    -- |Class: org.apache.spark.sql.catalyst.expressions.Abs               |
    -- |Usage: abs(expr) - Returns the absolute value of the numeric value.|
    -- +-------------------------------------------------------------------+
  • Viewing a built-in scalar function (extended information)
    DESC FUNCTION EXTENDED abs;
    -- +-------------------------------------------------------------------+
    -- |function_desc                                                      |
    -- +-------------------------------------------------------------------+
    -- |Function: abs                                                      |
    -- |Class: org.apache.spark.sql.catalyst.expressions.Abs               |
    -- |Usage: abs(expr) - Returns the absolute value of the numeric value.|
    -- |Extended Usage:                                                    |
    -- |    Examples:                                                      |
    -- |      > SELECT abs(-1);                                            |
    -- |       1                                                           |
    -- +-------------------------------------------------------------------+
  • Viewing a built-in aggregate function
    DESC FUNCTION max;
    -- +--------------------------------------------------------------+
    -- |function_desc                                                 |
    -- +--------------------------------------------------------------+
    -- |Function: max                                                 |
    -- |Class: org.apache.spark.sql.catalyst.expressions.aggregate.Max|
    -- |Usage: max(expr) - Returns the maximum value of `expr`.       |
    -- +--------------------------------------------------------------+
  • Viewing a generator function (extended information)
    DESC FUNCTION EXTENDED explode;
    -- +---------------------------------------------------------------+
    -- |function_desc                                                  |
    -- +---------------------------------------------------------------+
    -- |Function: explode                                              |
    -- |Class: org.apache.spark.sql.catalyst.expressions.Explode       |
    -- |Usage: explode(expr) - Separates the elements of array `expr`  |
    -- |  into multiple rows, or the elements of map `expr` into      |
    -- |  multiple rows and columns.                                   |
    -- |Extended Usage:                                                |
    -- |    Examples:                                                  |
    -- |      > SELECT explode(array(10, 20));                         |
    -- |       10                                                      |
    -- |       20                                                      |
    -- +---------------------------------------------------------------+