I have a column in Hive table with type:
array<array<struct<type:string,value:string,currency:string>>>
Here is the sample of data in the column:
[
[
{
"type": "PROFIT",
"value": "100",
"currency": "USD"
},
{
"type": "NET",
"value": "50",
"currency": "USD"
},
{
"type": "TOTAL",
"value": "250",
"currency": "USD"
}
]
]
How do I query each 'Type' to a column?
PROFIT | NET | TOTAL |
---|
Explode upper level array to get inner arrays of struct, use array index [] to access struct, use dot to access struct elements: