DESCRIBE FUNCTION

Description

DESCRIBE FUNCTION statement returns the basic metadata information of an existing function. The metadata information includes the function name, implementing class and the usage details. If the optional EXTENDED option is specified, the basic metadata information is returned along with the extended usage information.

Syntax

  1. { DESC | DESCRIBE } FUNCTION [ EXTENDED ] function_name

Parameters

  • function_name

    Specifies a name of an existing function in the system. The function name may be optionally qualified with a database name. If function_name is qualified with a database then the function is resolved from the user specified database, otherwise it is resolved from the current database.

    Syntax: [ database_name. ] function_name

Examples

  1. -- Describe a builtin scalar function.
  2. -- Returns function name, implementing class and usage
  3. DESC FUNCTION abs;
  4. +-------------------------------------------------------------------+
  5. |function_desc |
  6. +-------------------------------------------------------------------+
  7. |Function: abs |
  8. |Class: org.apache.spark.sql.catalyst.expressions.Abs |
  9. |Usage: abs(expr) - Returns the absolute value of the numeric value.|
  10. +-------------------------------------------------------------------+
  11. -- Describe a builtin scalar function.
  12. -- Returns function name, implementing class and usage and examples.
  13. DESC FUNCTION EXTENDED abs;
  14. +-------------------------------------------------------------------+
  15. |function_desc |
  16. +-------------------------------------------------------------------+
  17. |Function: abs |
  18. |Class: org.apache.spark.sql.catalyst.expressions.Abs |
  19. |Usage: abs(expr) - Returns the absolute value of the numeric value.|
  20. |Extended Usage: |
  21. | Examples: |
  22. | > SELECT abs(-1); |
  23. | 1 |
  24. | |
  25. +-------------------------------------------------------------------+
  26. -- Describe a builtin aggregate function
  27. DESC FUNCTION max;
  28. +--------------------------------------------------------------+
  29. |function_desc |
  30. +--------------------------------------------------------------+
  31. |Function: max |
  32. |Class: org.apache.spark.sql.catalyst.expressions.aggregate.Max|
  33. |Usage: max(expr) - Returns the maximum value of `expr`. |
  34. +--------------------------------------------------------------+
  35. -- Describe a builtin user defined aggregate function
  36. -- Returns function name, implementing class and usage and examples.
  37. DESC FUNCTION EXTENDED explode
  38. +---------------------------------------------------------------+
  39. |function_desc |
  40. +---------------------------------------------------------------+
  41. |Function: explode |
  42. |Class: org.apache.spark.sql.catalyst.expressions.Explode |
  43. |Usage: explode(expr) - Separates the elements of array `expr` |
  44. | into multiple rows, or the elements of map `expr` into |
  45. | multiple rows and columns. Unless specified otherwise, uses |
  46. | the default column name `col` for elements of the array or |
  47. | `key` and `value` for the elements of the map. |
  48. |Extended Usage: |
  49. | Examples: |
  50. | > SELECT explode(array(10, 20)); |
  51. | 10 |
  52. | 20 |
  53. +---------------------------------------------------------------+