Does exist an aggregate function that work as opposite of Flatten?

Hi everyboby,
I need to know a way to de-flatten a dataset.
My initial data is something like this:

Col1   | Col2
V1     | A
V1     | B
V2     | C

And I’d like a result like this:

Col1   | Col2
V1     | [ "A", "B" ]
V2     | [ "C" ]

Can anybody help me?

1 Like

Hello guys. I’m looking for a way to LISTAGG the results of a query.

I’ve noticed that to do the opposite of that, we can use regexp_split() + flatten() and get things done. Thus, if we could de-flatten a dataset would be very nice.