SHOW CREATE FUNCTION

概要

SHOW CREATE FUNCTION function_name [ ( parameter_type[, ...] ) ]

描述

顯示建立指定函數的 SQL 語句,如果指定了可選的參數類型列表。

如果省略參數類型列表,則針對給定 function_name 的每個簽名顯示一行。

範例

顯示可以執行以建立 example.default.array_sum(ARRAY<BIGINT>) 函數的 SQL 語句

SHOW CREATE FUNCTION example.default.array_sum(ARRAY<BIGINT>)
                                           Create Function                                            | Argument Types
------------------------------------------------------------------------------------------------------+----------------
 CREATE FUNCTION example.default.array_sum (                                                          | ARRAY(bigint)
    input ARRAY(bigint)                                                                             |
 )                                                                                                    |
 RETURNS bigint                                                                                       |
 COMMENT 'Calculate sum of all array elements. Nulls elements are ignored. Returns 0 on empty array.' |
 LANGUAGE SQL                                                                                         |
 DETERMINISTIC                                                                                        |
 RETURNS NULL ON NULL INPUT                                                                           |
 RETURN "reduce"(input, 0, (s, x) -> (s + COALESCE(x, 0)), (s) -> s)                                  |
(1 row)

顯示可以執行以建立 example.default.array_sum 函數的所有 SQL 語句

SHOW CREATE FUNCTION example.default.array_sum
                                           Create Function                                            | Argument Types
------------------------------------------------------------------------------------------------------+----------------
 CREATE FUNCTION example.default.array_sum (                                                         +| ARRAY(bigint)
    input ARRAY(bigint)                                                                            +|
 )                                                                                                   +|
 RETURNS bigint                                                                                      +|
 COMMENT 'Calculate sum of all array elements. Nulls elements are ignored. Returns 0 on empty array.'+|
 LANGUAGE SQL                                                                                        +|
 DETERMINISTIC                                                                                       +|
 RETURNS NULL ON NULL INPUT                                                                          +|
 RETURN "reduce"(input, 0, (s, x) -> (s + COALESCE(x, 0)), (s) -> s)                                  |
 CREATE FUNCTION example.default.array_sum (                                                         +| ARRAY(double)
    input ARRAY(double)                                                                            +|
 )                                                                                                   +|
 RETURNS double                                                                                      +|
 COMMENT 'Calculate sum of all array elements. Nulls elements are ignored. Returns 0 on empty array.'+|
 LANGUAGE SQL                                                                                        +|
 DETERMINISTIC                                                                                       +|
 RETURNS NULL ON NULL INPUT                                                                          +|
 RETURN "reduce"(input, double '0.0', (s, x) -> (s + COALESCE(x, double '0.0')), (s) -> s)            |
(2 rows)

另請參閱

CREATE FUNCTION