跳到主要内容

JSON_ARRAY_REDUCE

Introduced or updated: v1.2.644

Reduces a JSON array to a single value by applying a specified Lambda expression. For more information about Lambda expression, see Lambda Expressions.

Syntax

JSON_ARRAY_REDUCE(<json_array>, <lambda_expression>)

Examples

This example multiplies all the elements in the array (2 _ 3 _ 4):

SELECT JSON_ARRAY_REDUCE(
[2, 3, 4]::JSON,
(acc, d) -> acc::Int * d::Int
);

-[ RECORD 1 ]-----------------------------------
json_array_reduce([2, 3, 4]::VARIANT, (acc, d) -> acc::Int32 * d::Int32): 24
开始使用 Databend Cloud
低成本
快速分析
多种数据源
弹性扩展
注册