Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig, mail # user - How to transform Bag to table


+
Shai Harel 2011-04-26, 12:04
Copy link to this message
-
Re: How to transform Bag to table
Jacob Perkins 2011-04-26, 13:39
Nested cross is not supported at the moment, though it is in the works,
see: https://issues.apache.org/jira/browse/PIG-1916

Meanwhile, you could write a UDF to cross the items manually.

--jacob
@thedatachef

On Tue, 2011-04-26 at 15:04 +0300, Shai Harel wrote:
> I have a bag of items (a result after a group operation)
>
> (key1, {1, 2, 3})
> (key2, {1, 4, 5})
> ...
> ect
>
> i want to generate a CROSS product on each entry
> (key1, {(1,1), (1,2), (1,3), (2,2), (2,3), (3,3)})
> (key1, {(1,1), (1,4), (1,5), (4,4), (4,5), (5,5)})
>
> apparently i can't use CROSS statement  inside a FOREACH...
> cr = FOREACH rr{
> cr = CROSS $1.$1, $1.$1;
> GENERATE cr;
> }; --this is wrong...
>
> Anybody has a suggestion?
+
Shai Harel 2011-04-26, 14:13