Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
0.7.0
-
None
-
None
Description
It would be good to be able to cross inside a foreach:
A = load 'data' as (ind:int, ind2:int, ind3:int, value:int); B = group A by ind; C = foreach B { c = cross A.(ind2, value), A.(ind3, value); generate group as ind, FLATTEN(c) as (ind2, value1, ind3, value2); }
This reassures me that the cross is happening only within the group of ind1 and not generating a full (ind1, ind2, ind3) cross, and then limiting to just one ind1.
In the words of the manual Pig Latin Reference Manual 2, ver0.7 this ticket asks for "cross" to be added as a "nested_op". Consider also the following example:
A = load 'data' as (ind:int, ind2:int, ind3:int, ind4:int, value:int); B = group A by ind; C = foreach B { c1 = cross A.(ind2, value), A.(ind3, value); c2 = cross A.(ind2, value), A.(ind4, value); generate group as ind, FLATTEN(c1) as (ind2, value1, ind3, value2), FLATTEN(c2) as (ind4, value1, ind5, value2); }
which you would not be able to accomplish without a cross nested_op.
Attachments
Issue Links
- duplicates
-
PIG-1916 Nested cross
- Closed