How to 'filter' an array of structs in Hive without exploding?

Viewed 28

Suppose I have this data in a Hive table:


fname | lname | records |
------|-------|---------|
 John |  Doe  | [{"name": "John", "lname": "Doe", "age": 55}, {"name": "Jacky", "lname": "Collins", "age": 67}] |
 Jane |  Doe  | [{"name": "John", "lname": "Doe", "age": 55}, {"name": "Jacky", "lname": "Collins", "age": 67}] |

I want to get the records.age for the matching fname and lname without exploding records column. Is there a way to do this?

Result would be:

fname | lname | age  |
------|-------|------|
 John |  Doe  | 55   |
 Jane |  Doe  | NULL |
0 Answers
Related