I have to take the first 25 IDs ranked by count(*). But the following is
not allowed in Hive
select id from T order by count(*) desc limit 25;
Which yields a "NOt yet supported place for UDAF count". The way around it
is the following
select id, count(*) as cnt from T group by id order by cnt de
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+WindowingAndAnalytics
This should help you , try rank/ dense rank as appropriate and mold it to
best use for yourself
Regards
Dev
On Mar 7, 2016 10:35 PM, "Awhan Patnaik" wrote:
> I have to take the first 25 IDs ranked by count(*).
Hi,
You arte looking at the top 25 of result set so you will have to get full
result set before looking at top 25
Something like this
select rs.prod_id, rs.score from
(
prod_id, count(prod_id) AS Score from sales GROUP BY prod_id ORDER BY
Score DESC
)rs
LIMIT 25;
HTH
Dr Mich Talebzadeh