Combining Multiple Rows into Multiple Columns Grouped by a Single Field

Viewed 19

I'm working in Hive and would like to combine multiple rows into multiple columns with a ranking condition and grouped by user:

What I have:

User Hobby Is Healthy Rank
User A Coding true 1
User A Reading true 2
User B Fishing true 1
User B Posting Excessively on Stackoverflow false 2

Desired output:

User Hobby_0 Is_healthy_0 Hobby_1 Is_healthy_1
User A Coding true Reading true
User B Fishing true Posting Excessively on Stackoverflow false

How might I go about this?

0 Answers
Related