DESCRIBE FUNCTION
説明
DESCRIBE FUNCTION
ステートメントは、既存の関数の基本的なメタデータ情報を返します。メタデータ情報には、関数名、実装クラス、使用方法の詳細が含まれます。省略可能な EXTENDED
オプションが指定された場合、基本的なメタデータ情報は、使用方法に関する追加情報と一緒に返されます。
構文
{ DESC | DESCRIBE } FUNCTION [ EXTENDED ] function_name
パラメータ
-
function_name
システム内の既存の関数の名前を指定します。関数は、オプションでデータベース名で修飾できます。
function_name
がデータベースで修飾されている場合、関数はユーザー指定データベースから解決され、そうでない場合は現在のデータベースから解決されます。構文:
[ database_name. ] function_name
例
-- Describe a builtin scalar function.
-- Returns function name, implementing class and usage
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.|
+-------------------------------------------------------------------+
-- Describe a builtin scalar function.
-- Returns function name, implementing class and usage and examples.
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 |
| |
+-------------------------------------------------------------------+
-- Describe a builtin 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`. |
+--------------------------------------------------------------+
-- Describe a builtin user defined aggregate function
-- Returns function name, implementing class and usage and examples.
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. Unless specified otherwise, uses |
| the default column name `col` for elements of the array or |
| `key` and `value` for the elements of the map. |
|Extended Usage: |
| Examples: |
| > SELECT explode(array(10, 20)); |
| 10 |
| 20 |
+---------------------------------------------------------------+