共用方式為


SHOW FUNCTIONS

適用於: 檢查標示為是 Databricks SQL 檢查標示為是 Databricks Runtime

套用選擇性的 regex 模式之後,傳回函式的清單。 Databricks SQL 支援大量的函式。 您可以與 describe 函式搭配使用SHOW FUNCTIONS,快速尋找函式,並瞭解如何使用它。 子 LIKE 句是選擇性的,可確保與其他系統相容。

語法

SHOW [ function_kind ] FUNCTIONS [ { FROM | IN } schema_name ]
                                 [ [ LIKE ] { function_name | regex_pattern } ]

function_kind
  { USER | SYSTEM | ALL }

參數

  • function_kind

    要搜尋之函式的名稱空間。 有效的名稱空白為:

    • USER - 查閱使用者定義函式中的函式。
    • SYSTEM - 查閱系統定義函式中的函式。
    • ALL - 在使用者和系統定義函式之間查閱函式。
  • schema_name

    適用於: 檢查標示為是 Databricks SQL 檢查標示為是 Databricks Runtime 10.4 LTS 和更新版本

    指定要列出函式的架構。

  • function_name

    系統中現有函式的名稱。 如果未 schema_name 提供 ,則函式名稱可能會改用架構名稱來限定。 如果 function_name 不是限定且 schema_name 尚未指定,則會從目前的架構解析函式。

  • regex_pattern

    正則表達式模式,用來篩選 語句的結果。

    • *除了 和 | 字元以外,模式的運作方式就像正則表達式。
    • * 單獨比對 0 或多個字元,並 | 用來分隔多個不同的正則表示式,其中任何一個都可以比對。
    • 前置和尾端空白會在處理之前,先在輸入模式中修剪。 模式比對不區分大小寫。

範例

-- List a system function `trim` by searching both user defined and system
-- defined functions.
> SHOW FUNCTIONS trim;
     trim

-- List a system function `concat` by searching system defined functions.
> SHOW SYSTEM FUNCTIONS concat;
   concat

-- List a qualified function `max` from schema `salesdb`.
> SHOW SYSTEM FUNCTIONS IN salesdb max;
     max

-- List all functions starting with `t`
> SHOW FUNCTIONS LIKE 't*';
               tan
              tanh
         timestamp
           tinyint
            to_csv
           to_date
           to_json
      to_timestamp
 to_unix_timestamp
  to_utc_timestamp
         transform
    transform_keys
  transform_values
         translate
              trim
             trunc
            typeof

-- List all functions starting with `yea` or `windo`
> SHOW FUNCTIONS LIKE 'yea*|windo*';
   window
     year

-- Use normal regex pattern to list function names that has 4 characters
-- with `t` as the starting character.
> SHOW FUNCTIONS LIKE 't[a-z][a-z][a-z]';
     tanh
     trim