parameter -> expression
参数 | 说明 |
parameter | 用于传递参数的标识符。 |
expression | 表达式,大多数的 Mysql 表达式都可以在 Lambda 表达式使用。例如:
|
* | SELECT filter(array[5, null, 7, null], x -> x is not null)
[5,7]
* | SELECT reduce(array[5, 20, 50], 0, (s, x) -> s + x, s -> s)
75
* | SELECT map_filter(map(array['class01', 'class02', 'class03'], array[11, 10, 9]), (k,v) -> v > 10)
{"class01":11}
* | SELECT zip_with(array['a', 'b', 'c'], array['d', 'e', 'f'], (x, y) -> concat(x, y))
["ad","be","cf"]
* | SELECT transform(array[5, NULL, 6], x -> coalesce(x, 0) + 1)
[6,1,7]
* | SELECT filter(array[], x -> true)* | SELECT map_filter(map(array[],array[]), (k, v) -> true)* | SELECT reduce(array[5, 6, 10, 20], -- calculates arithmetic average: 10.25cast(row(0.0, 0) AS row(sum double, count integer)),(s, x) -> cast(row(x + s.sum, s.count + 1) AS row(sum double, count integer)),s -> if(s.count = 0, null, s.sum / s.count))* | SELECT reduce(array[2147483647, 1], cast(0 AS bigint), (s, x) -> s + x, s -> s)* | SELECT reduce(array[5, 20, null, 50], 0, (s, x) -> s + x, s -> s)* | SELECT transform(array[array[1, null, 2], array[3, null]], a -> filter(a, x -> x is not null))
本页内容是否解决了您的问题?