Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am exploring a way to achive this like the SQL below in flink.

SELECT a_tag,NEST(type) AS type_arr FROM a GROUP BY a_tag

NEST() is a user defined function whitch aggregate int to array<int>.

But i can't change the output type because the UDF class extends AggregateFunction

Is there any suggestion?Thanks a lot.

question from:https://stackoverflow.com/questions/65644052/how-can-i-aggregate-int-column-to-arrayint-in-flink

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
95 views
Welcome To Ask or Share your Answers For Others

1 Answer

Flink has provided a built-in aggregation function called collect() whitch can handle this situation.

Note that the result type of collect() will be MULTISET


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...