select map_values
(
str_to_map
(
concat_ws
(
','
,sort_array
(
collect_list
(
concat_ws
(
':'
,lpad(cast(pos as string),10,'0')
,cast(sum_val as string)
)
)
)
)
)
) as sum_col_array
from (select pos
,sum (val) as sum_val
from mytable t
lateral view posexplode(array(*)) pe
group by pos
) t
;
1条答案
按热度按时间lp0sw83n1#
或者(上帝保佑我)