Hi,
Thanks for the excellent tool.

I want to traverse a tuple of tuples in pig.

1<tab>((t1,1),(t2,2),(t3,3))
2<tab>((t3,3),(t4,4))

I defined the load schema as follows r1 = LOAD 'file:///home/irfan/qw/sql/pig/tuple_test.txt' using PigStorage() as (c1:chararray, t01:tuple(t11:tuple(k1:chararray, v1:chararray)));

I want to be able output something like

t1,1
t2,1
t3,2
t4,1

Everytime I only get the first inner tuple (t11) of the outer tuple (t01)

Please see the attached input data and the sample pig script trying to traverse the tuple of tuples.

Thanks,
Irfan
1       ((t1,1),(t2,2),(t3,3))
2       ((t3,3),(t4,4))
r1 = LOAD 'file:///home/irfan/qw/sql/pig/tuple_test.txt' using PigStorage() as 
(c1:chararray, t01:tuple(t11:tuple(k1:chararray, v1:chararray)));

dump r1;
describe r1;

r2 = foreach r1 generate flatten(t01.t11);

dump r2;
describe r2;

/*
r3 = foreach r2 generate group.t11;

dump r3;
describe r3;

r4 = group r3 by t02;

dump r4;
describe r4;

r5 = foreach r4 {
  generate $0;
}

dump r5;
describe r5;
*/

-- store r3 into 'file:///home/irfan/qw/sql/pig/tuple_test_output.txt' using 
PigStorage(',');

Reply via email to