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)