In BigQquery how can I aggregate arrays element by element ?
For instance if I have this table
| id | array_value |
|---|---|
| 1 | [1, 2, 3] |
| 2 | [4, 5, 6] |
| 3 | [7, 8, 9] |
I want to sum all the vector element-wise and output [1+4+7, 2+5+8, 3+6+9] = [12, 15, 18]
I can SUM float fields with SELECT SUM(float_field) FROM table but when I try to apply the SUM on an array I get
No matching signature for aggregate function SUM for argument types: ARRAY. Supported signatures: SUM(INT64); SUM(FLOAT64); SUM(NUMERIC); SUM(BIGNUMERIC) at [1:8]
I have found ARRAY_AGG in the doc but it is not what I want: it just creates an array from values.