Aggregating arrays element wise
问题 Pretty new to spark/scala. I am wondering if there is an easy way to aggregate an Array[Double] in a column-wise fashion. Here is an example: c1 c2 c3 ------------------------- 1 1 [1.0, 1.0, 3.4] 1 2 [1.0, 0,0, 4.3] 2 1 [0.0, 0.0, 0.0] 2 3 [1.2, 1.1, 1.1] Then, upon aggregation, I would end with a table that looks like: c1 c3prime ------------- 1 [2.0, 1.0, 7.7] 2 [1.2, 1.1, 1.1] Looking at UDAF now, but was wondering if I need to code at all? Thanks for your consideration. 回答1: Assuming the