Add cross as a nested_op
------------------------

                 Key: PIG-1665
                 URL: https://issues.apache.org/jira/browse/PIG-1665
             Project: Pig
          Issue Type: New Feature
          Components: grunt
    Affects Versions: 0.7.0
            Reporter: hc busy


It would be good to be able to cross inside a foreach:
\\
{code}
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);
}
{code}

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|http://hadoop.apache.org/pig/docs/r0.7.0/piglatin_ref2.html#FOREACH] 
this ticket asks for "cross" to be added as a "nested_op". Consider also the 
following example:

{code}
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);
}
{code}

which you would not be able to accomplish without a cross nested_op.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to