Re: Invalid Function rank in HiveQL

2012-07-10 Thread Raihan Jamal
Yup this works. Thanks for the help. *Raihan Jamal* On Tue, Jul 10, 2012 at 4:37 PM, Vijay wrote: > In that case, wouldn't this work: > > SELECT buyer_id, item_id, rank(buyer_id), created_time > FROM ( > SELECT buyer_id, item_id, created_time > FROM testingtable1 > DISTRIBUTE BY

Re: Invalid Function rank in HiveQL

2012-07-10 Thread Vijay
In that case, wouldn't this work: SELECT buyer_id, item_id, rank(buyer_id), created_time FROM ( SELECT buyer_id, item_id, created_time FROM testingtable1 DISTRIBUTE BY buyer_id SORT BY buyer_id, created_time desc ) a WHERE rank(buyer_id) < 10; On Tue, Jul 10, 2012 at 4:21 PM, Rai

Re: Invalid Function rank in HiveQL

2012-07-10 Thread Vijay
This is a little tricky but this is how it works: SELECT buyer_id, item_id, rank(item_id), created_time FROM ( SELECT buyer_id, item_id, created_time FROM testingtable1 DISTRIBUTE BY buyer_id, item_id SORT BY buyer_id, item_id, created_time desc ) a WHERE rank(item_id) < 10; On T

Re: Invalid Function rank in HiveQL

2012-07-10 Thread Raihan Jamal
Still it's not working with the use of my rank UDF. Below is the query I am using Can anyone help me, what changes I need to make in my below sql query? CREATE TABLE IF NOT EXISTS TestingTable1 ( BUYER_ID BIGINT, ITEM_ID BIGINT, CREATED_TIME STRING ) *Find TOP 10 latest data (ITEM_ID, CREATE

Re: Invalid Function rank in HiveQL

2012-07-10 Thread Jasper Knulst
Hi Raihan, You should use 'rank(buyer_id)' in the order by clause on line 9 in stead of the alias 'rk'. I had the same problem, strangely, the alias is not resolved when it is in the order by clause. Other thing, I had some issues when I used this exact same set up for ranking results, that the r

Re: Invalid Function rank in HiveQL

2012-07-10 Thread Nitin Pawar
change this " SELECT buyer_id, item_id, created_time" to " SELECT buyer_id, item_id, created_time, rk" On Tue, Jul 10, 2012 at 12:30 PM, Raihan Jamal wrote: > I was not able to understand, This is my below qiuery that I am using > currently- > > SELECT buyer_id, item_id, created_time > FROM ( >

Re: Invalid Function rank in HiveQL

2012-07-10 Thread Raihan Jamal
I was not able to understand, This is my below qiuery that I am using currently- SELECT buyer_id, item_id, created_time FROM ( SELECT buyer_id, item_id, rank(buyer_id) as rank, created_time FROM testingtable1 DISTRIBUTE BY buyer_id, item_id SORT BY buyer_id, item_id, created_time d

Re: Invalid Function rank in HiveQL

2012-07-09 Thread Nitin Pawar
try rk in upper select statement as well On Tue, Jul 10, 2012 at 12:12 PM, Raihan Jamal wrote: > Thanks for commenting out. Yes I figured that out, its a UDF. So now I > have created a new UDF Rank and added to classpath also. But when I am > again running the below query- > > SELECT buyer_id, i

Re: Invalid Function rank in HiveQL

2012-07-09 Thread Raihan Jamal
Thanks for commenting out. Yes I figured that out, its a UDF. So now I have created a new UDF Rank and added to classpath also. But when I am again running the below query- SELECT buyer_id, item_id, created_time FROM ( SELECT buyer_id, item_id, Rank(buyer_id) as rk, created_time FROM testi

Re: Invalid Function rank in HiveQL

2012-07-09 Thread Vijay
hive has no built-in rank function. you'd need to use a user-defined function (UDF) to simulate it. there are a few custom implementations on the net that you can leverage. On Mon, Jul 9, 2012 at 10:40 PM, Raihan Jamal wrote: > What's wrong with the below query. > > > SELECT buyer_id, item_id, cr