Clickhouse: Is there accumulate for array?

Created on 2 Jun 2019  Β·  2Comments  Β·  Source: ClickHouse/ClickHouse

data : [1, 4, 6, 8]

result : 1 * 4 * 6 * 8 = 192

question

Most helpful comment


SELECT exp2(arraySum(x -> log2(x), [1, 4, 6, 8]))

β”Œβ”€exp2(arraySum(lambda(tuple(x), log2(x)), [1, 4, 6, 8]))─┐
β”‚                                                     192 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

All 2 comments


SELECT exp2(arraySum(x -> log2(x), [1, 4, 6, 8]))

β”Œβ”€exp2(arraySum(lambda(tuple(x), log2(x)), [1, 4, 6, 8]))─┐
β”‚                                                     192 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Good idea, Thanks

Was this page helpful?
0 / 5 - 0 ratings