My data is in VARCHAR
format. I want to split both the elements of this array so that I can then extract a key value from the JSON.
Data format
[
{
"skuId": "5bc87ae20d298a283c297ca1",
"unitPrice": 0,
"id": "5bc87ae20d298a283c297ca1",
"quantity": "1"
},
{
"skuId": "182784738484wefhdchs4848",
"unitPrice": 50,
"id": "5bc87ae20d298a283c297ca1",
"quantity": "4"
},
]
For example I want to extract skuid
from the above column.
So my data after extraction should look like:
1 5bc87ae20d298a283c297ca1
2 182784738484wefhdchs4848
Cast to array doesn't work either:
SELECT CAST(col AS ARRAY)
gives the following error:
Unknown type: array
So I am not able to un-nest the array.
How do I do solve this problem in Presto Athena?
INVALID_CAST_ARGUMENT: Cannot cast JSON to array(row(skuid varchar))
– Protagonist