Before row 2 you need to write out the tuple or insert it into a bag or 
whatever it is you're going to do with it and then create a new tuple.  Changes 
shown inline.

On Feb 28, 2012, at 8:08 PM, chethan wrote:

> Hi,
> 
> import org.apache.pig.data.Tuple;
> 
> Tuple data (1,2,3,4)
>                (4,5,6,7)
>                (8,9,10,11)
> 
> i want to store these entire Tuple data as shown above.
> 
> Tuple data = TupleFactory.getInstance().newTuple(4); // intialized
DataBag bag = BagFactory.getInstance().newDefaultBag();
> 
> // row 1
> 
> data.set(1, 1);
> 
> data.set(2, 2);
> 
> data.set(3, 3);
> 
> data.set(4, 4);
bag.add(data);
data = TupleFactory.getInstance().newTuple(4); 

> 
> // row 2
> 
> data.set(1, 5);
> 
> data.set(2, 6);
> 
> data.set(3, 7);
> 
> data.set(4, 8);
> 
> when i am inserting row 2 row 1 is over writting row 1, i am going wrong?
> 
> i want to insert it as another row, how to do it.
> 
> 
> Thanks & Regards
> 
> chethan prakash

Reply via email to