How to aggregate several columns into a JSON file for each group in HIVE

Viewed 1449

I want to convert the following table into a new table with two rows. In the new table, each user_id has one JSON file to summarize all other columns in the first table.

user_id reservation_id nights price AAA 10001 1 100 AAA 10002 1 120 BBB 20003 7 350 to user_id reservation_details AAA {10001:{'nights':1, 'price':100}, 10002:{'nights':1, 'price':120}} BBB {20003:{'nights':7, 'price':350}}

1 Answers
Related