Does this solve it?

grunt> DATA = LOAD 'data' USING PigStorage('|') as (groupBy:chararray ,
condition :chararray);

grunt> FILTERED = FILTER DATA BY condition == 'Y';

grunt> GROUPED = GROUP FILTERED BY condition;

grunt> TUPLED = foreach GROUPED generate
FLATTEN(BagToTuple(FILTERED.groupBy));

grunt> describe TUPLED;

TUPLED: {org.apache.pig.builtin.bagtotuple_482::groupBy: chararray}

grunt> dump TUPLED;

(Column1,Column3,Column4)



On Mon, Jan 25, 2016 at 6:55 PM, Divya Gehlot <[email protected]>
wrote:

> Hi,
> I have file data as below
> Data is dynamic
>
> Column1 | Y
> Column2 | N
> Column3 |Y
> Column4| Y
> Column5|N
>
> I need to filter the data which is Y and then
> read those columns as tuple so that I can pass to my Groupby function
>
> Filter data
> Column1,Y
> Column3,Y
> Column4,Y
>
> and then cnvert column1,column3,column4 as tuple .
>
> Would really aprreciate the pointers.
>
> Thanks,
> Divya
>

Reply via email to