I tried your

Hi,
your problem is that all the data is being loaded in c1, as a chararray. So b1 is empty.

Somehow PigStorage is not informed of the fact that ',' is a field separator. Using PigStorage(',') changes the result, but does not solve the problem.

I tried modifying the data, using a tab '\t' instead of a comma ',' to separate c1 from b1, and it works.

So now Data is like this:
a       {(1,1,1)}
b       {(2,2,2),(3,3,3)}
c       {(4,4,4),(5,5,5),(6,6,6)}


Hope it helps,
Gianmarco

PS: Maybe I am wrong, but I think this is a question to be asked on the pig-user mailing list.

Il giorno 09/set/10, alle ore 12:47, Sankar Sangili ha scritto:

Hi ,

I am new to Pig, would like to know how to work with nested bag. I tried
with the sample code and am getting an empty output .

Thanks,
Sankar

Data
(a,{(1,1,1)})
(b,{(2,2,2),(3,3,3)})
(c,{(4,4,4),(5,5,5),(6,6,6)})

Query
grunt>A = LOAD 'data' AS (c1:chararray,b1: bag {t1: tuple(i1:int, i2:int,
i3:int)});
grunt>B = foreach A generate b1;
grunt> dump B;

Output
()
()
()

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you



Reply via email to