Member since
07-12-2019
1
Post
0
Kudos Received
0
Solutions
07-12-2019
01:34 AM
Here's a hack I come up with for whoever might need it: SELECT
-- Presto version:
-- map_agg(attr_id, attr_val) AS attrs
str_to_map(
-- Split the string into map by \x1 and \x2
concat_ws(
-- join the list with \x2
string(unhex(2)),
-- Create a list of "attr_id \x1 val" strings
collect_list(concat_ws(string(unhex(1)), string(attr_id), attr_val))
),
string(unhex(2)),
string(unhex(1))
) AS attrs
FROM attrs_tall
... View more