I have a big nested struct in AWS Athena. Here's one column named "petowners" in the table:
{_id=5e6b531a412345e0e86aeae0, status=NotAnalyzed, animalcategories=[{categoryname=mammals, matches=1}, {categoryname=birds, matches=2}, {categoryname= UnknownField, matches=4}], ...many-other-values}
I'm looking for:
- The equivalent of the python function
value_countsin the column. Meaning I'm looking for the SQL Athena command that will output for this row:[mammals:1, birds:2, UnknownField:4] - A way to query aggregation - to create a histogram of total number
of pets per owner for this
row = 7 - How many pet owners have an
UnknownFieldin 'animalycategories' - How many animal types are there in the entire table?