title: PIG Error 1066 after iterating through a joined set.
body: <p>Trying to join a one set which has number of days in the month with a data set on the year month key.  After I join the and try to do a FOREACH over the set I get an ERROR: 1066 ... Backend error : Scalar has more than one row in the output.</p>
  
  <p>Here is an abbreviated set with the same problem:</p>
  
  <pre><code>$ hadoop fs -cat DIM/\*
  2011,01,31
  2011,02,28
  2011,03,31
  2011,04,30
  2011,05,31
  2011,06,30
  2011,07,31
  2011,08,31
  2011,09,30
  2011,10,31
  2011,11,30
  2011,12,31
  
  $ hadoop fs -cat ACCT/\*
  2011,7,26,key1,23.25,2470.0
  2011,7,26,key2,10.416666666666668,232274.08333333334
  2011,7,26,key3,82.83333333333333,541377.25
  2011,7,26,key4,78.5,492823.33333333326
  2011,7,26,key5,110.83333333333334,729811.9166666667
  2011,7,26,key6,102.16666666666666,675941.25
  2011,7,26,key7,118.91666666666666,770896.75
  </code></pre>
  
  <p>Then in grunt:</p>
  
  <pre><code>grunt&gt; DIM = LOAD 'DIM' USING PigStorage(',') AS (year:int, month:int, days:int);
  grunt&gt; ACCT = LOAD 'ACCT' USING PigStorage(',') AS (year:int, month:int, day: int, account:chararray, metric1:double, metric2:double);
  grunt&gt; AjD = JOIN ACCT BY (year,month), DIM  BY (year,month) USING 'replicated';
  grunt&gt; dump AjD;
  ...
  (2011,7,26,key1,23.25,2470.0,2011,7,31)
  (2011,7,26,key2,10.416666666666668,232274.08333333334,2011,7,31)
  (2011,7,26,key3,82.83333333333333,541377.25,2011,7,31)
  (2011,7,26,key4,78.5,492823.33333333326,2011,7,31)
  (2011,7,26,key5,110.83333333333334,729811.9166666667,2011,7,31)
  (2011,7,26,key6,102.16666666666666,675941.25,2011,7,31)
  (2011,7,26,key7,118.91666666666666,770896.75,2011,7,31)
  grunt&gt; describe AjD;
  AjD: {ACCT::year: int,ACCT::month: int,ACCT::day: int,ACCT::account: chararray,ACCT::metric1: double,ACCT::metric2: double,DIM::year: int,DIM::month: int,DIM::days: int}
  
  grunt&gt; FINAL = FOREACH AjD
  &gt;&gt; GENERATE ACCT.year, ACCT.month, ACCT.account, (ACCT.metric2 / DIM.days);
  grunt&gt; dump FINAL;
  ...
  ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1066: Unable to open iterator for alias FINAL. Backend error : Scalar has more than one row in the output. 1st : (2011,7,26,key1,23.25,2470.0), 2nd :(2011,7,26,key2,10.416666666666668,232274.08333333334)
  </code></pre>
  
  <p>However if I store it and reload it to shed the "join" schema it works:</p>
  
  <pre><code>grunt&gt; STORE AjD INTO 'AjD' using PigStorage(',');
  grunt&gt; AjD2 = LOAD 'AjD' USING PigStorage(',') AS (year:int, month:int, day:int, account:chararray, metric1:double, metric2:double, year2:int, month2:int, days:int);
  
  grunt&gt; FINAL = FOREACH AjD2                                                                   
  &gt;&gt; GENERATE year, month, account, (metric2 /days);         
  
  grunt&gt; dump FINAL;
  ...
  (2011,7,key1,79.6774193548387)
  (2011,7,key2,7492.712365591398)
  (2011,7,key3,17463.782258064515)
  (2011,7,key4,15897.526881720427)
  (2011,7,key5,23542.319892473122)
  (2011,7,key6,21804.5564516129)
  (2011,7,key7,24867.637096774193)
  </code></pre>
  
  <p>Is there a way to iterate (FOREACH) over the joined set without storing and reloading?</p>