Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 0.7.0
    • Fix Version/s: None
    • Component/s: grunt
    • Labels:
      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.

        Issue Links

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              hc busy
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development