More efficient way to unnest arrays

Viewed 118

I currently have a map<string, string>, where the value string is a concatenated, comma-separated, list. In a presto server, I have done the following:

SELECT DISTINCT
    key, 
    unnested_tags
FROM (
    SELECT
        a.k,
        SPLIT(a.v, ',') AS v
    FROM table
    CROSS JOIN UNNEST(tags) AS a (k, v)
)
CROSS JOIN UNNEST(v) AS a (unnested_tags)

Is there a better way to unnest this map, while also unnesting the false array?

0 Answers
Related