lundi 19 mai 2014

la ruche - valeurs de comte dans les tableaux - Stack Overflow


Is it possible to count the values in a hive arrays without explode and a where clause? An example would be something like this:


   user      events 
1 ["1","2","2","2","4"]


select user, count_array(events,"2") as event_count
from mytable

where the result would be


 user      event_count 
1 3


Is it possible to count the values in a hive arrays without explode and a where clause? An example would be something like this:


   user      events 
1 ["1","2","2","2","4"]


select user, count_array(events,"2") as event_count
from mytable

where the result would be


 user      event_count 
1 3

0 commentaires:

Enregistrer un commentaire