trinodb / trino

Official repository of Trino, the distributed SQL query engine for big data, formerly known as PrestoSQL (https://trino.io)
https://trino.io
Apache License 2.0
10.23k stars 2.95k forks source link

Add `set_union` aggregate function #16683

Open gurustron opened 1 year ago

gurustron commented 1 year ago

Presto supports set_union aggregate function:

set_union(array(T)) -> array(T) Returns an array of all the distinct values contained in each array of the input

Can we add it to Trino?

Workarounds: use array handling:

array_distinct(flatten(array_agg(array_col)))
ebyhr commented 1 year ago

cc: @martint

exherb commented 2 months ago

array_distinct(flatten(array_agg(array_col))) use lots of memory