> Hi Guys,
>
>
>
> I have a query that needs to compare previous value of a tuple to that of
current value, and mark if there is change in the value.
>
>
>
> input:
> year, AccNo
> 1991 ,1234
> 1992 ,1234
> 1993 ,1234
> 1991 ,1235
> 1992 ,1235
> 1991 ,1236
> 1991 ,1237
>
>
>
> Output:-
>
> recyear ,AccNo, firstrec
> 1991, 1234, 1
> 1992, 1234, 0
> 1993, 1234, 0
> 1991,1235, 1
> 1992, 1235, 0
> 1991, 1236, 1
> 1991, 1237, 1
>
>
>
> My Aprroch:-
>
>
>
> --adding two ranks
> rank1 = rank input BY Accno,recyear;
> rank2 = rank rank1 by Accno;
>
> --create first_rec
> output = foreach rank2 generate *, ($0==$1?1:0) as first_rec;
>
>
>
>
>
> It doesn't seem to be working great , please can anyone give some idea if
we have any anylytical fucntions to crack this.
>
>
>
> Thanks a lot
>
> Srinivas