Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Ranking when date changes but with a specifi condition

Ranking when date changes but with a specifi condition

New Contributor

I have fields orig_date, Fields1, Field2 and I want to calculate rank as follows using hive , any suggestions.

Orig_dateField1Field2Rank
9/1/2017111
9/2/2017012
9/3/2017103
9/4/2017004
9/5/2017004
9/6/2017004
9/7/2017004
9/8/2017115
9/9/2017106
9/10/2017117
9/11/2017118
9/12/2017009
9/13/2017009
9/14/20171110
9/15/20171111

2 REPLIES 2

Re: Ranking when date changes but with a specifi condition

New Contributor

What is the logic behind this

Re: Ranking when date changes but with a specifi condition

Hi @ganesh kumar morla

I couldn't see any principle followed in the ranking method. Could you explain how do you want the rank to be generated?

In general if you want to generate rank in hive , it can be accomplished by rank() over(order by orig_date).