Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-19 Thread Jérôme Verdier
Below you can find the 3 working queries from my script : rank() over (partition by sg.co_societe,sg.id_produit order by sg.date_maj desc,sg.co_type_ref) as rang RANK(pnvente.dt_debut_commercial, COALESCE(pnvente.id_produit,dem.id_produit)) OVER (PARTITION BY mag.co_magasin, dem.id_produit ORDER

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-19 Thread Edward Capriolo
Please send the fnal working queries. On Friday, July 19, 2013, Jérôme Verdier wrote: > Hi, > > The error is resolved. > > I have 3 RANK() function in my script. > > 2 are working with arguments, but one is working without arguments. > > I don't understand it, but the fact is it's working =) > >

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-19 Thread Jérôme Verdier
Hi, The error is resolved. I have 3 RANK() function in my script. 2 are working with arguments, but one is working without arguments. I don't understand it, but the fact is it's working =) Thanks everyone for your help. 2013/7/18 Jérôme Verdier > Hi, > > Since we saw that we have to give a

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-18 Thread Jérôme Verdier
Hi, Since we saw that we have to give arguments in RANK() function, i'm trying to translate this one (working on Oracle 10g) to be functionnally in Hive : RANK() OVER (PARTITION BY mag.co_magasin, dem.id_produit ORDER BY pnvente.dt_debut_commercial DESC, COALESCE(pnvente.id_produit,dem.id_produit

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-17 Thread Richa Sharma
my bad ... in relational databases we generally do not give a column name inside rank() ... but the one in (partition by order by..) is sufficient. But looks like that's not the case in Hive Jerome, Please look at the examples in link below. See if you are able to make it work https://cwi

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-17 Thread Jérôme Verdier
Hi Richa, I have tried one query, with what i've understand of Vijay's tips. SELECT code_entite, RANK(mag.me_vente_ht) OVER (PARTITION BY mag.co_societe ORDER BY mag.me_vente_ht) AS rank FROM default.thm_renta_rgrp_produits_n_1 mag; This query is working, it gives me results. You say that may

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-17 Thread Richa Sharma
Vijay Jerome has already passed column -> mag.co_societe for rank. syntax -> RANK() OVER (PARTITION BY mag.co_societe ORDER BY mag.me_vente_ht) This will generate a rank for column mag.co_societe based on column value me_vente_ht Jerome, Its possible you are also hitting the same bug as I menti

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-17 Thread Jérôme Verdier
Hi Vijay, Could you give me an example, i'm not sure of what you're meaning. Thanks, 2013/7/17 Vijay > As the error message states: "One ore more arguments are expected," you > have to pass a column to the rank function. > > > On Wed, Jul 17, 2013 at 1:12 AM, Jérôme Verdier < > verdier.jerom.

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-17 Thread Vijay
As the error message states: "One ore more arguments are expected," you have to pass a column to the rank function. On Wed, Jul 17, 2013 at 1:12 AM, Jérôme Verdier wrote: > Hi Richa, > > I have tried a simple query without joins, etc > > SELECT RANK() OVER (PARTITION BY mag.co_societe ORDER

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-17 Thread Jérôme Verdier
Hi Richa, I have tried a simple query without joins, etc SELECT RANK() OVER (PARTITION BY mag.co_societe ORDER BY mag.me_vente_ht),mag.co_societe, mag.me_vente_ht FROM default.thm_renta_rgrp_produits_n_1 mag; Unfortunately, the error is the same like previously. Error: Query returned non-ze

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-16 Thread Richa Sharma
Jerome I would recommend that you try Rank function with columns from just one table first. Once it is established that rank is working fine then add all the joins. I am still on Hive 0.10 so cannot test it myself. However, I can find a similar issue on following link - so its possible you are fa

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-16 Thread Jérôme Verdier
You can see my query below : SELECT mag.co_magasin, dem.id_produit as id_produit_orig, pnvente.dt_debut_commercial as dt_debut_commercial, COALESCE(pnvente.id_produit,dem.id_produit) as id_prod

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-16 Thread Richa Sharma
Can you share query with just RANK(). Richa On Tue, Jul 16, 2013 at 6:08 PM, Jérôme Verdier wrote: > Hi Richa, > > I tried to execute the rank function alone, but the result is the same > > Thanks > > > 2013/7/16 Richa Sharma > >> Hi Jerome >> >> >> I think the problem is you are trying to use

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-16 Thread Jérôme Verdier
Hi Richa, I tried to execute the rank function alone, but the result is the same Thanks 2013/7/16 Richa Sharma > Hi Jerome > > > I think the problem is you are trying to use MIN, SUM and RANK function in > a single query. > > Try to get the rank first in a query and on top of it apply these >

Re: Use RANK OVER PARTITION function in Hive 0.11

2013-07-16 Thread Richa Sharma
Hi Jerome I think the problem is you are trying to use MIN, SUM and RANK function in a single query. Try to get the rank first in a query and on top of it apply these aggregate functions Richa On Tue, Jul 16, 2013 at 2:15 PM, Jérôme Verdier wrote: > Hi, > > I have a problem while using RAN

Use RANK OVER PARTITION function in Hive 0.11

2013-07-16 Thread Jérôme Verdier
Hi, I have a problem while using RANK OVER PARTITION function with Hive. Hive is in version 0.11 and, as we can see here : https://cwiki.apache.org/Hive/languagemanual-windowingandanalytics.html, we can now use these functions in Hive. But, when i use it, i encountered this error : FAILED: Sema