hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ravi Prasad <raviprasa...@gmail.com>
Subject Re: Analytic functions in Lead & Lag in Hive
Date Mon, 17 Nov 2014 05:41:06 GMT
Hi Karthik,
  Thanks.  But we are using Hive 0.10 version of Hive.
Is there any alternative way available to implement this Lead / Lag
functionality in Hive 0.10 version

Regards
Raviprasad

On Fri, Nov 14, 2014 at 7:51 PM, Dhandapani, Karthik <
Karthik.Dhandapani@cvscaremark.com> wrote:

> Ravi,
>
>
>
> Lead and Lag functions are introduced only in hive 0.11 version. Please
> refer to the below link for more details.
>
>
>
>
> https://cwiki.apache.org/confluence/display/Hive/LanguageManual+WindowingAndAnalytics
>
>
>
> Thanks,
>
> Karthik
>
>
>
> *From:* Ravi Prasad [mailto:raviprasad29@gmail.com]
> *Sent:* Friday, November 14, 2014 3:08 AM
> *To:* user@hive.apache.org
> *Subject:* Analytic functions in Lead & Lag in Hive
>
>
>
> Cany anyone suggest, how to use the Lead and lag function in Hive.
>
> I am using Hive* 0.10 version*. Is there any way to make it work in 0.10
> version.
>
> I have used  the below code in Oracle,  But it is not working in Hive.
>
> I need to compare the difference between the previous record and currect
> record.
>
>
>
> *Oracle code for LAG :-*
>
> SELECT empno,
>
>        ename,
>
>        job,
>
>        sal,
>
>        LAG(sal, 1, 0) OVER (ORDER BY sal) AS sal_prev,
>
>        sal - LAG(sal, 1, 0) OVER (ORDER BY sal) AS sal_diff
>
> FROM   emp;
>
>
>
> *Oracle code for LEAD :-*
>
> SELECT empno,
>
>        ename,
>
>        job,
>
>        sal,
>
>        LEAD(sal, 1, 0) OVER (ORDER BY sal) AS sal_next,
>
>        LEAD(sal, 1, 0) OVER (ORDER BY sal) - sal AS sal_diff
>
> FROM   emp;
>
>
>
>
>
>
>
> --
>
> ----------------------------------------------
> Regards,
> Prasad
>



-- 
----------------------------------------------
Regards,
RAVI PRASAD. T

Mime
View raw message