I think the following will do what you want.
t1 = load table1 as id, listOfId;
t2 = load table2 as id, f1;
t1a = foreach t1 generate flatten(listOfId); -- flattens the lisOfId
into a set of ids
b = join t1a by $0, t2 by id; -- join the two together.
c = foreach b generate t2.id, t2.f1; -- project just the ids and f1 entries.
Alan.
Joydeep Sen Sarma wrote:
Specifically, how can we express this query:
Table1 contains: id, (list of ids)
Table2 contains: id, f1
Where the Table1:list is a variable length list of foreign key (id) into
Table2.
We would like to join every element of Table1:list with corresponding
Table2:id. Ie. The final output should of the form:
Table3 contains: id, (list of f1)
Couldn't quite figure out how to do this - does Pig Latin support nested
foreach loops? If there's a more appropriate mailing list - please
re-direct,
Thanks,
Joydeep