You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Bhathiya Jayasekara <to...@gmail.com> on 2013/05/15 11:45:22 UTC
How to do a calculation among 2 rows?
Hi all,
Can someone please give an idea for this? I'm totally stuck.
http://stackoverflow.com/questions/16558438/in-hive-how-to-do-a-calculation-among-2-rows
Thanks.
--Bhathiya
Re: How to do a calculation among 2 rows?
Posted by John Meagher <jo...@gmail.com>.
There's a new release candidate version of Hive that includes
windowing functions that address this. RC1 is available at
http://people.apache.org/~hashutosh/hive-0.11.0-rc1/. Also see
https://issues.apache.org/jira/browse/HIVE-896
Without 0.11 the approach from Paul will work, but will be slow.
On Wed, May 15, 2013 at 7:53 AM, Paul COURTOIS <pa...@pole-conseils.com> wrote:
> Hi Bhathiya,
>
> what about cartesian product ?
>
> the idea would be something like that :
> select a, b, c from t1
> join t1 as t2 on t2.a = t1.a
> where t2.b > t1.b
>
> it's not very "elegant", but should work ;-)
>
> Paul
>
>
> 2013/5/15 Bhathiya Jayasekara <to...@gmail.com>
>>
>> Hi all,
>>
>> Can someone please give an idea for this? I'm totally stuck.
>>
>>
>> http://stackoverflow.com/questions/16558438/in-hive-how-to-do-a-calculation-among-2-rows
>>
>> Thanks.
>>
>> --Bhathiya
>
>
Re: How to do a calculation among 2 rows?
Posted by Paul COURTOIS <pa...@pole-conseils.com>.
Hi Bhathiya,
what about cartesian product ?
the idea would be something like that :
select a, b, c from t1
join t1 as t2 on t2.a = t1.a
where t2.b > t1.b
it's not very "elegant", but should work ;-)
Paul
2013/5/15 Bhathiya Jayasekara <to...@gmail.com>
> Hi all,
>
> Can someone please give an idea for this? I'm totally stuck.
>
>
> http://stackoverflow.com/questions/16558438/in-hive-how-to-do-a-calculation-among-2-rows
>
> Thanks.
>
> --Bhathiya
>