In Clickhouse, I have a table like so:
ID | frame | vector
123, 0, [-0.1,0.3,0.2]
123, 1, [0.3, 0.2, -0.1]
456, 0, [-0.2, 0.1, 0.2]
i want to query this data so that it outputs:
ID | avg_vector
123, [0.1, 0.25, 0.05]
456, [-0.2, 0.1, 0.2]
but the functions i seem to find only provide averaging an array, not averaging two arrays together.
i tried:
SELECT
id,
arrayMap(
i -> arrayReduce('avg', arrayMap(x -> x[i], groupArray(vector))),
range(3)
) AS avg_vector
FROM embeddings
GROUP BY id
but this i believe is working across each element, not between arrays
New contributor
Dojo Nik is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.