Compute Statistical mode in Hive Compute Statistical mode in Hive hadoop hadoop

Compute Statistical mode in Hive


There is no mention of a mode function in the official docs (see Built-in Aggregate Functions).

But the query to get the mode of a column is pretty simple, so a native function might not be necessary.

select age from (    select age, count(age) as age_cnt    from mytable    group by age    order by age_cnt desc    limit 1) t1