Skip to content
Advertisement

Count ROW type item Athena / Presto

I have an Athena query like this

and the result is

I would like to count the number of records per day per devices to have a result like this

EDIT

My dataset is actually like this

Here the expected results would be :

Advertisement

Answer

You can cast your json to map and count number of keys:

Output:

device_id date recordsNb
abc 2021-07-24 2
def 2021-07-24 3

UPD

Since you have ROWs, not json values, you can try next:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement