I am trying to figure out a way in Hive to select data from a flat source and output into an array of named struct(s). Here is a example of what I am looking for...
Sample Data:
house_id,first_name,last_name
1,bob,jones
1,jenny,jones
2,sally,johnson
3,john,smith
3,barb,smith
Desired Output:
1 [{"first_name":"bob","last_name":"jones"},{"first_name":"jenny","last_name":"jones"}]
2 [{"first_name":"sally","last_name":"johnson"}]
3 [{"first_name":"john","last_name":"smith"},{"first_name":"barb","last_name":"smith"}]
I tried collect_list and collect_set but they only allow primitive data types. Any thoughts of how I might go about this in Hive?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…