0001 ---
0002 layout: global
0003 title: DESCRIBE FUNCTION
0004 displayTitle: DESCRIBE FUNCTION
0005 license: |
0006 Licensed to the Apache Software Foundation (ASF) under one or more
0007 contributor license agreements. See the NOTICE file distributed with
0008 this work for additional information regarding copyright ownership.
0009 The ASF licenses this file to You under the Apache License, Version 2.0
0010 (the "License"); you may not use this file except in compliance with
0011 the License. You may obtain a copy of the License at
0012
0013 http://www.apache.org/licenses/LICENSE-2.0
0014
0015 Unless required by applicable law or agreed to in writing, software
0016 distributed under the License is distributed on an "AS IS" BASIS,
0017 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0018 See the License for the specific language governing permissions and
0019 limitations under the License.
0020 ---
0021
0022 ### Description
0023
0024 `DESCRIBE FUNCTION` statement returns the basic metadata information of an
0025 existing function. The metadata information includes the function name, implementing
0026 class and the usage details. If the optional `EXTENDED` option is specified, the basic
0027 metadata information is returned along with the extended usage information.
0028
0029 ### Syntax
0030
0031 ```sql
0032 { DESC | DESCRIBE } FUNCTION [ EXTENDED ] function_name
0033 ```
0034
0035 ### Parameters
0036
0037 * **function_name**
0038
0039 Specifies a name of an existing function in the system. The function name may be
0040 optionally qualified with a database name. If `function_name` is qualified with
0041 a database then the function is resolved from the user specified database, otherwise
0042 it is resolved from the current database.
0043
0044 **Syntax:** `[ database_name. ] function_name`
0045
0046 ### Examples
0047
0048 ```sql
0049 -- Describe a builtin scalar function.
0050 -- Returns function name, implementing class and usage
0051 DESC FUNCTION abs;
0052 +-------------------------------------------------------------------+
0053 |function_desc |
0054 +-------------------------------------------------------------------+
0055 |Function: abs |
0056 |Class: org.apache.spark.sql.catalyst.expressions.Abs |
0057 |Usage: abs(expr) - Returns the absolute value of the numeric value.|
0058 +-------------------------------------------------------------------+
0059
0060 -- Describe a builtin scalar function.
0061 -- Returns function name, implementing class and usage and examples.
0062 DESC FUNCTION EXTENDED abs;
0063 +-------------------------------------------------------------------+
0064 |function_desc |
0065 +-------------------------------------------------------------------+
0066 |Function: abs |
0067 |Class: org.apache.spark.sql.catalyst.expressions.Abs |
0068 |Usage: abs(expr) - Returns the absolute value of the numeric value.|
0069 |Extended Usage: |
0070 | Examples: |
0071 | > SELECT abs(-1); |
0072 | 1 |
0073 | |
0074 +-------------------------------------------------------------------+
0075
0076 -- Describe a builtin aggregate function
0077 DESC FUNCTION max;
0078 +--------------------------------------------------------------+
0079 |function_desc |
0080 +--------------------------------------------------------------+
0081 |Function: max |
0082 |Class: org.apache.spark.sql.catalyst.expressions.aggregate.Max|
0083 |Usage: max(expr) - Returns the maximum value of `expr`. |
0084 +--------------------------------------------------------------+
0085
0086 -- Describe a builtin user defined aggregate function
0087 -- Returns function name, implementing class and usage and examples.
0088 DESC FUNCTION EXTENDED explode
0089 +---------------------------------------------------------------+
0090 |function_desc |
0091 +---------------------------------------------------------------+
0092 |Function: explode |
0093 |Class: org.apache.spark.sql.catalyst.expressions.Explode |
0094 |Usage: explode(expr) - Separates the elements of array `expr` |
0095 | into multiple rows, or the elements of map `expr` into |
0096 | multiple rows and columns. Unless specified otherwise, uses |
0097 | the default column name `col` for elements of the array or |
0098 | `key` and `value` for the elements of the map. |
0099 |Extended Usage: |
0100 | Examples: |
0101 | > SELECT explode(array(10, 20)); |
0102 | 10 |
0103 | 20 |
0104 +---------------------------------------------------------------+
0105 ```
0106
0107 ### Related Statements
0108
0109 * [DESCRIBE DATABASE](sql-ref-syntax-aux-describe-database.html)
0110 * [DESCRIBE TABLE](sql-ref-syntax-aux-describe-table.html)
0111 * [DESCRIBE QUERY](sql-ref-syntax-aux-describe-query.html)