Re: Correlated Subqueries Workaround in Hive!

2014-09-15 Thread Furcy Pin
Hi, what you are trying to do looks very much like what the LAG windowing function does. If your version of Hive is 0.11 or higher, I suggest trying it. The hive doc for windowing function is here (but is quite poor): https://cwiki.apache.org/confluence/display/Hive/LanguageManual+WindowingAndAnal

Re: Correlated Subqueries Workaround in Hive!

2014-09-15 Thread Nitin Pawar
Other way I can think at this is .. 1) ignore all -1 and create a tmp table 2) I see there are couple of time stamps 3) Oder the table by timestamp 4) from this tmp tabel create anothe tmp table which says FK MinStartTime MaxEndTime Location 5) Now this tmp table from step 4 join with ur raw data

Re: Correlated Subqueries Workaround in Hive!

2014-09-15 Thread Viral Parikh
thanks! is there any other way than writing python UDF etc. any way i can leverage hive joins to get this working? On Mon, Sep 15, 2014 at 6:56 AM, Sreenath wrote: > How about writing a python UDF that takes input line by line > and it saves the previous lines location and can replace it with

Re: Correlated Subqueries Workaround in Hive!

2014-09-15 Thread Sreenath
How about writing a python UDF that takes input line by line and it saves the previous lines location and can replace it with that if location turns out to be '-1' On 15 September 2014 17:01, Nitin Pawar wrote: > have you taken a look at lag and lead functions ? > > On Mon, Sep 15, 2014 at 4:46

Re: Correlated Subqueries Workaround in Hive!

2014-09-15 Thread Nitin Pawar
have you taken a look at lag and lead functions ? On Mon, Sep 15, 2014 at 4:46 PM, Viral Parikh wrote: > To Whomsoever It May Concern, > > I posted this question last week but still haven't heard from anyone; I'd > appreciate any reply. > > I've got a table that contains a LocationId field. In s

Correlated Subqueries Workaround in Hive!

2014-09-15 Thread Viral Parikh
To Whomsoever It May Concern, I posted this question last week but still haven't heard from anyone; I'd appreciate any reply. I've got a table that contains a LocationId field. In some cases, where a record shares the same foreign key, the LocationId might come through as -1. What I want to do i