Skip to content
Advertisement

SQL/Presto expanding a list column into multiple rows

Given a hive table like

How can I create a secondary table like

Advertisement

Answer

This is a textbook case for unnest:

Output:

a bb
1 1
1 2
1 3
2 2
2 3
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement